home *** CD-ROM | disk | FTP | other *** search
/ ADA Programming Guide / ADA Programming Guide.iso / ada_gwu / adared.c < prev    next >
C/C++ Source or Header  |  1996-01-30  |  89KB  |  3,403 lines

  1. /* Reduce: This is the reduce action for ada. When called, the array
  2.    rh is created which contains pointers to the structures on the
  3.    top of the parse stack (prs_stack). To do this we traverse the 
  4.    stack. As this is happening, when we find a terminal on the stack,
  5.    we free the token structure for this terminal. After the traversal,
  6.    we then free all the structures on the top of the stack as indicated
  7.    by the length of the right hand side of the rule except one, which is
  8.    kept for reuse for the non-terminal being formed by the current reduction.
  9.    When we free the stack structures and the token structures, we have not
  10.    actually released the storage, but have put it back into a free pool
  11.    for reuse. However in this function we never allocate a stack or token
  12.    structure from our pool, so the data held in these structures remains
  13.    intact. A special case is when the right hand side of the rule has zero
  14.    symbols, when we instead allocate a new stack strucure and do not free
  15.    anything. */
  16.  
  17. #include "hdr.h"
  18. #include "vars.h"
  19. #include "ada.h"
  20. #include "adared.h"
  21. #include "nodesp.h"
  22. #include "smiscp.h"
  23. #include "setp.h"
  24. #include "adalexp.h"
  25. #include "reducep.h"
  26. #include "ppredefp.h"
  27. #include "pspansp.h"
  28. #include "prsutilp.h"
  29. #include "errsp.h"
  30. #include "adaredp.h"
  31. #include "miscp.h"
  32.  
  33. /* Macros for convenient use of the rh array:
  34. AST(n) represents the node in the nth position of the rh array (non-terminal).
  35. IND(n) repesents the index of the terminal in the nth position of rh.
  36. LOC(n) represents the starting loc of the terminal in the nth pos of rh.
  37. END_LOC(n) represents the ending loc of the terminal in the nth pos of rh.
  38. */
  39. #define AST(j) (rh[j]->ptr.ast)
  40. #define IND(j) (rh[j]->ptr.token->index)
  41. #define LOC(j) (&rh[j]->ptr.token->span)
  42. #define END_LOC(j)     \
  43.     make_span(LOC(j)->line,LOC(j)->col+strlen(namelist(IND(j)))-1)
  44.  
  45. /* FREEAST recursively frees the nth child of node and its children. */
  46. #define FREEAST(node,n) {if ((node->links.subast)[n] != OPT_NODE) \
  47.     free_everything((node->links.subast)[n]);}
  48.  
  49. static Node make_id(int);
  50. static struct prsstack *rh[MAX_RHS];
  51.  
  52. void reduce(int red)                                    /*;reduce*/
  53. {
  54.     Fortup ft1;
  55.     int n = rhslen[red];
  56.     struct prsstack *tmp, *top;
  57.     Node node, id_node, tmp_node;
  58.  
  59.     /* n is the length (# of grammar symbols) of the right hand side of
  60.      *  the production.  Set up the array 'rh' to contain the n symbols
  61.      *  from the top of the parse stack.  These are popped from the stack
  62.      *  in the process, except for 1 which is left to be overridden by
  63.      *  the new node created during the reduction (note that when n = 0
  64.      *  a new postion on the top of the stack has to be created).
  65.      */
  66.  
  67.     if (!n) {
  68.         tmp = PRSALLOC();
  69.         tmp->prev = prs_stack;
  70.         prs_stack = tmp;
  71.     }
  72.     else {
  73.         if (n == 1) {
  74.             rh[0] = prs_stack;
  75.         }
  76.         else {
  77.             top = prs_stack;
  78.             while (--n > 1) {
  79.                 rh[n] = prs_stack;
  80.                 prs_stack = prs_stack->prev;
  81.             }
  82.             rh[1] = tmp = prs_stack;
  83.             rh[0] = prs_stack = prs_stack->prev;
  84.             PRSFREE(top, tmp);
  85.         }
  86.     }
  87.  
  88.     if (redopt)
  89.         fprintf(errfile, "Rule %d [%d]\n", red + 1, rhslen[red]);
  90.     switch (red + 1) {
  91.  
  92.      break;
  93.  /* pragma ::= PRAGMA identifier [(argument_association{,argument_association */
  94.  case 1 :
  95. {
  96.     Node arg_assoc_list_node = AST(2);
  97.     Tuple arg_assoc_list;
  98.     char *name_id;
  99.     int pragma_type = 0;
  100.  
  101.     arg_assoc_list = N_LIST(arg_assoc_list_node);
  102.     node = any_node;
  103.     if (!strcmp(namelist(IND(1)), "LIST")) {
  104.         if (tup_size(arg_assoc_list) != 1)
  105.             prs_warning(LOC(0), LOC(3),
  106.               "Pragma LIST takes one argument: ON or OFF");
  107.         else {
  108.             Node arg = (Node) arg_assoc_list[1];
  109.             Node opt_id = N_AST1(arg);
  110.             Node expression = N_AST2(arg);
  111.  
  112.             if (opt_id != OPT_NODE)
  113.                 prs_warning(LOC(0), LOC(3),
  114.                   "Named argument is invalid for pragma LIST");
  115.             else if (N_KIND(expression) != as_name)
  116.                 prs_warning(LOC(0), LOC(3),
  117.                   "Argument passed to pragma LIST is invalid");
  118.             else {
  119.                 Node name = N_AST1(expression);
  120.  
  121.                 if (N_KIND(name) != as_simple_name)
  122.                     prs_warning(LOC(0), LOC(3),
  123.                       "Name argument passed to pragma LIST is invalid");
  124.                 else {
  125.                     name_id = namelist(N_ID(name));
  126.                     if (!strcmp(name_id, "ON"))
  127.                         pragma_type = PRAGMA_LIST_ON;
  128.                     else if (!strcmp(name_id, "OFF"))
  129.                         pragma_type = PRAGMA_LIST_OFF;
  130.                     else {
  131.                         char msg[100];
  132.  
  133.                         sprintf(msg,
  134.                  "Identifier %s is an invalid argument passed to pragma LIST",
  135.                           name_id);
  136.                         prs_warning(LOC(0), LOC(3), msg);
  137.                     }
  138.                 }
  139.             }
  140.         }
  141.         if (!pragma_type)
  142.             write_pragma(PRAGMA_LIST_ERR, LOC(0), LOC(3));
  143.     }
  144.     else if (!strcmp(namelist(IND(1)), "PAGE"))
  145.         pragma_type = PRAGMA_PAGE;
  146.     else {
  147.         Node arg2_node, name_node, simple_name_node;
  148.  
  149.         if (!strcmp(namelist(IND(1)), "IO_INTERFACE")) {
  150.             arg_assoc_list = N_LIST(arg_assoc_list_node);
  151.             /* get second argument of pragma io_interface and change node
  152.              * from as_simple_name to as_line_no whose n_val contains
  153.              * the internal number of the io routine
  154.              * TBSL: this node kind should not be as_line_no, however this
  155.              * avoids adding a new node kind for the moment!
  156.              * The node we are changing is 2 levels down in the tree!
  157.              */
  158.             arg2_node = (Node) arg_assoc_list[2]; /* 2nd as_arg node*/
  159.             name_node = N_AST2(arg2_node);
  160.             simple_name_node = N_AST1(name_node);
  161.             N_KIND(simple_name_node) = as_line_no;
  162.             N_ID(simple_name_node) =
  163.               predef_code(namelist(N_ID(simple_name_node)));
  164.         }
  165.         node = node_new(as_pragma);
  166.         id_node = make_id(1);
  167.         insert_2child(node, id_node, arg_assoc_list_node);
  168.     }
  169.     if (pragma_type)
  170.         write_pragma(pragma_type, LOC(0), LOC(3));
  171. }
  172.  
  173.  /* argument_association ::= [argument_identifier=>]expression */
  174.  /* case 2 : */
  175.  
  176.  /* basic_declaration ::= object_declaration */
  177.  /* case 3 : */
  178.  
  179.  /* basic_declaration ::= number_declaration */
  180.  /* case 4 : */
  181.  
  182.  /* basic_declaration ::= type_declaration */
  183.  /* case 5 : */
  184.  
  185.  /* basic_declaration ::= subtype_declaration */
  186.  /* case 6 : */
  187.  
  188.  /* basic_declaration ::= subprogram_declaration */
  189.  /* case 7 : */
  190.  
  191.  /* basic_declaration ::= package_declaration */
  192.  /* case 8 : */
  193.  
  194.  /* basic_declaration ::= task_declaration */
  195.  /* case 9 : */
  196.  
  197.  /* basic_declaration ::= generic_declaration */
  198.  /* case 10 : */
  199.  
  200.  /* basic_declaration ::= exception_declaration */
  201.  /* case 11 : */
  202.  
  203.  /* basic_declaration ::= generic_instantiation */
  204.  /* case 12 : */
  205.  
  206.  /* basic_declaration ::= renaming_declaration */
  207.  /* case 13 : */
  208.  
  209.      break;
  210.  /* object_declaration ::= identifier_list : subtype_indication [:=expression */
  211.  case 14 :
  212.     node = node_new(as_obj_decl);
  213.     insert_3child(node, AST(0), AST(2), AST(3));
  214.  
  215.      break;
  216.  /* object_declaration ::= identifier_list : CONSTANT subtype_indication [:=e */
  217.  case 15 :
  218.     node = node_new(as_const_decl);
  219.     insert_3child(node, AST(0), AST(3), AST(4));
  220.  
  221.      break;
  222.  /* object_declaration ::= identifier_list : [CONSTANT] constrained_array_def */
  223.  case 16 :
  224.     node = node_new((AST(2) == OPT_NODE) ? as_obj_decl : as_const_decl);
  225.     insert_3child(node, AST(0), AST(3), AST(4));
  226.  
  227.      break;
  228.  /* number_declaration ::= identifier_list : CONSTANT := universal_static_exp */
  229.  case 17 :
  230.     node = node_new(as_num_decl);
  231.     insert_2child(node, AST(0), AST(4));
  232.  
  233.      break;
  234.  /* identifier_list ::= identifier {,identifier} */
  235.  case 18 :
  236.     node = AST(1);
  237.     id_node = make_id(0);
  238.     prepend(id_node, node);
  239.  
  240.  /* type_declaration ::= full_type_declaration */
  241.  /* case 19 : */
  242.  
  243.  /* type_declaration ::= incomplete_type_declaration */
  244.  /* case 20 : */
  245.  
  246.  /* type_declaration ::= private_type_declaration */
  247.  /* case 21 : */
  248.  
  249.      break;
  250.  /* full_type_declaration ::= TYPE identifier [discriminant_part]IS type_defi */
  251.  case 22 :
  252.     id_node = make_id(1);
  253.     node = node_new(as_type_decl);
  254.     insert_3child(node, id_node, AST(2), AST(3));
  255.  
  256.  /* type_definition ::= enumeration_type_definition */
  257.  /* case 23 : */
  258.  
  259.  /* type_definition ::= integer_type_definition */
  260.  /* case 24 : */
  261.  
  262.  /* type_definition ::= real_type_definition */
  263.  /* case 25 : */
  264.  
  265.  /* type_definition ::= array_type_definition */
  266.  /* case 26 : */
  267.  
  268.  /* type_definition ::= record_type_definition */
  269.  /* case 27 : */
  270.  
  271.  /* type_definition ::= access_type_definition */
  272.  /* case 28 : */
  273.  
  274.  /* type_definition ::= derived_type_definition */
  275.  /* case 29 : */
  276.  
  277.      break;
  278.  /* subtype_declaration ::= SUBTYPE identifier IS subtype_indication ; */
  279.  case 30 :
  280.     id_node = make_id(1);
  281.     node = node_new(as_subtype_decl);
  282.     insert_2child(node, id_node, AST(3));
  283.  
  284.      break;
  285.  /* subtype_indication ::= type_mark [constraint] */
  286.  case 31 :
  287.     node = node_new(as_subtype_indic);
  288.     insert_2child(node, AST(0), AST(1));
  289.  
  290.  /* constraint ::= range_constraint */
  291.  /* case 32 : */
  292.  
  293.  /* constraint ::= floating_point_constraint */
  294.  /* case 33 : */
  295.  
  296.  /* constraint ::= fixed_point_constraint */
  297.  /* case 34 : */
  298.  
  299.      break;
  300.  /* constraint ::= general_aggregate */
  301.  case 35 :
  302. {
  303.     Node element;
  304.     Tuple new_list;
  305.  
  306.     node = AST(0);
  307.     new_list = tup_new(0);
  308.     N_KIND(node) = as_constraint;
  309.  
  310.     /*  "Range" elements of the general_aggregate represent the constraints
  311.          of an indexed-constrained array.  The base types of the constraints
  312.          are left as optional in the AST and have to be resolved semantically
  313.          by looking at the definition of the corresponding type_mark.  See
  314.          the definition of "subtype_indication".
  315.     */
  316.     FORTUP(tmp_node = (Node), N_LIST(node), ft1);
  317.         if (N_KIND(tmp_node) == as_range) {
  318.             element = node_new(as_subtype);
  319.             insert_2child(element, OPT_NODE, tmp_node); }
  320.         else
  321.             element = tmp_node;
  322.         new_list = tup_with(new_list, (char *)element);
  323.     ENDFORTUP(ft1);
  324.  
  325.     N_LIST(node) = new_list;
  326. }
  327.  
  328.      break;
  329.  /* derived_type_definition ::= NEW subtype_indication */
  330.  case 36 :
  331.     node = node_new(as_derived_type);
  332.     insert_1child(node, AST(1));
  333.  
  334.      break;
  335.  /* range_constraint ::= RANGE range */
  336.  case 37 :
  337. {
  338.     Span save_span;
  339.  
  340.     node = AST(1);
  341.     if (N_KIND(node) != as_range && N_KIND(node) != as_range_attribute) {
  342.         syntax_err(SPAN(node), "Invalid range specification");
  343.         save_span = get_left_span_p(node);
  344.         node = OPT_NODE;
  345.          set_span(node, save_span);
  346.     }
  347. }
  348.  
  349.      break;
  350.  /* range ::= range_attribute */
  351.  case 38 :
  352. {
  353.     Node name;
  354.     node = AST(0);
  355.     name = N_AST1(node);
  356.     if (N_KIND(node) == as_name) {
  357.         if (N_KIND(name) == as_attribute) {
  358.             if (N_ID(N_AST1(name)) == RANGE_SYM) {
  359.                 Node tmp;
  360.  
  361.                 tmp = name;
  362. /*
  363.                 astfree(node->links.subast);
  364. */
  365.                 nodefree(node);
  366.                 node = tmp;
  367.                 N_KIND(node) = as_range_attribute;
  368.             }
  369.         }
  370.         else
  371.             N_KIND(node) = as_range_expression;
  372.     }
  373. }
  374.  
  375.      break;
  376.  /* range ::= simple_expression .. simple_expression */
  377.  case 39 :
  378.     node = node_new(as_range);
  379.     insert_2child(node, AST(0), AST(2));
  380.  
  381.      break;
  382.  /* enumeration_type_definition ::= ( enumeration_literal_specification {,enu */
  383.  case 40 :
  384.     node = AST(2);
  385.     prepend(AST(1), node);
  386.     N_KIND(node) = as_enum;
  387.  
  388.  /* enumeration_literal_specification ::= enumeration_literal */
  389.  /* case 41 : */
  390.  
  391.      break;
  392.  /* enumeration_literal ::= identifier */
  393.  case 42 :
  394.     node = node_new(as_simple_name);
  395.     N_ID(node) = IND(0);
  396.     set_span(node, LOC(0));
  397.  
  398.      break;
  399.  /* enumeration_literal ::= character_literal */
  400.  case 43 :
  401.     node = node_new(as_character_literal);
  402.     N_ID(node) = IND(0);
  403.     set_span(node, LOC(0));
  404.  
  405.      break;
  406.  /* integer_type_definition ::= range_constraint */
  407.  case 44 :
  408.     node = node_new(as_int_type);
  409.     insert_1child(node, AST(0));
  410.  
  411.      break;
  412.  /* real_type_definition ::= floating_point_constraint */
  413.  case 45 :
  414.     node = node_new(as_float_type);
  415.     insert_1child(node, AST(0));
  416.  
  417.      break;
  418.  /* real_type_definition ::= fixed_point_constraint */
  419.  case 46 :
  420.     node = node_new(as_fixed_type);
  421.     insert_1child(node, AST(0));
  422.  
  423.      break;
  424.  /* floating_point_constraint ::= floating_accuracy_definition [range_constra */
  425.  case 47 :
  426.     node = AST(0);
  427.     N_AST2(node) = AST(1);
  428.  
  429.      break;
  430.  /* floating_accuracy_definition ::= DIGITS static_simple_expression */
  431.  case 48 :
  432.     node = node_new(as_digits);
  433.     insert_2child(node, AST(1), any_node);
  434.  
  435.      break;
  436.  /* fixed_point_constraint ::= fixed_accuracy_definition [range_constraint] */
  437.  case 49 :
  438.     node = AST(0);
  439.     N_AST2(node) = AST(1);
  440.  
  441.      break;
  442.  /* fixed_accuracy_definition ::= DELTA static_simple_expression */
  443.  case 50 :
  444.     node = node_new(as_delta);
  445.     insert_2child(node, AST(1), any_node);
  446.  
  447.  /* array_type_definition ::= unconstrained_array_definition */
  448.  /* case 51 : */
  449.  
  450.  /* array_type_definition ::= constrained_array_definition */
  451.  /* case 52 : */
  452.  
  453.      break;
  454.  /* unconstrained_array_definition ::= ARRAY ( index_subtype_definition {,ind */
  455.  case 53 :
  456.     prepend(AST(2), AST(3));
  457.     node = node_new(as_array_type);
  458.     insert_2child(node, AST(3), AST(6));
  459.  
  460.      break;
  461.  /* constrained_array_definition ::= ARRAY index_constraint OF component_subt */
  462.  case 54 :
  463.     node = node_new(as_array_type);
  464.     insert_2child(node, AST(1), AST(3));
  465.  
  466.      break;
  467.  /* index_subtype_definition ::= name RANGE <> */
  468.  case 55 :
  469.     if (!check_expanded_name(AST(0)))
  470.         syntax_err(SPAN(AST(0)),
  471.             "Invalid type_mark used in index_subtype_definition");
  472.     node = node_new(as_box);
  473.     insert_1child(node, AST(0));
  474.  
  475.      break;
  476.  /* index_constraint ::= ( discrete_range {,discrete_range} ) */
  477.  case 56 :
  478.     node = AST(2);
  479.     prepend(AST(1), node);
  480.     FORTUP(tmp_node = (Node), N_LIST(node), ft1);
  481.         check_discrete_range(tmp_node);
  482.     ENDFORTUP(ft1);
  483.  
  484.      break;
  485.  /* discrete_range ::= name range_constraint */
  486.  case 57 :
  487.     if (!check_expanded_name(AST(0)))
  488.         syntax_err(SPAN(AST(0)),
  489.             "Discrete_subtype_indication must be a type_mark");
  490.     node = node_new(as_subtype);
  491.     insert_2child(node, AST(0), AST(1));
  492.  
  493.      break;
  494.  /* discrete_range ::= range */
  495.  case 58 :
  496.     if (N_KIND(AST(0)) == as_range) {
  497.         node = node_new(as_subtype);
  498.         insert_2child(node, OPT_NODE, AST(0));
  499.     }
  500.     else
  501.         node = AST(0);
  502.  
  503.      break;
  504.  /* record_type_definition ::= RECORD component_list END RECORD */
  505.  case 59 :
  506.     node = node_new(as_record);
  507.     insert_1child(node, AST(1));
  508.  
  509.      break;
  510.  /* component_list ::= {pragma} {component_declaration} component_declaration */
  511.  case 60 :
  512.     check_pragmas(AST(0), null_pragmas);
  513.     check_pragmas(AST(3), null_pragmas);
  514.     N_LIST(AST(1)) = tup_with(tup_add(N_LIST(AST(0)),
  515.        N_LIST(AST(1))), (char *)AST(2));
  516.     node = node_new(as_component_list);
  517.     insert_3child(node, AST(1), OPT_NODE, AST(3));
  518.     nodefree(AST(0));
  519.  
  520.      break;
  521.  /* component_list ::= {pragma} {component_declaration} variant_part {pragma} */
  522.  case 61 :
  523.     check_pragmas(AST(0), null_pragmas);
  524.     check_pragmas(AST(3), null_pragmas);
  525.     N_LIST(AST(1)) = tup_add(N_LIST(AST(0)),
  526.       N_LIST(AST(1)));
  527.     node = node_new(as_component_list);
  528.     insert_3child(node, AST(1), AST(2), AST(3));
  529.     nodefree(AST(0));
  530.  
  531.      break;
  532.  /* component_list ::= {pragma} NULL ; {pragma} */
  533.  case 62 :
  534.     N_LIST(AST(0)) = tup_add(N_LIST(AST(0)), N_LIST(AST(3)));
  535.     check_pragmas(AST(0), null_pragmas);
  536.     node = node_new(as_component_list);
  537.     insert_3child(node, OPT_NODE, OPT_NODE, AST(0));
  538.     nodefree(AST(3));
  539.  
  540.      break;
  541.  /* component_declaration ::= identifier_list : component_subtype_definition  */
  542.  case 63 :
  543.     node = node_new(as_field);
  544.     insert_3child(node, AST(0), AST(2), AST(3));
  545.  
  546.      break;
  547.  /* discriminant_part ::= ( discriminant_specification {;discriminant_specifi */
  548.  case 64 :
  549.     node = AST(2);
  550.     prepend(AST(1), node);
  551.  
  552.      break;
  553.  /* discriminant_specification ::= identifier_list : type_mark [:=expression] */
  554.  case 65 :
  555.     node = node_new(as_discr_spec);
  556.     insert_3child(node, AST(0), AST(2), AST(3));
  557.  
  558.      break;
  559.  /* variant_part ::= CASE discriminant_simple_name IS {pragma} variant {varia */
  560.  case 66 :
  561.     check_pragmas(AST(3), null_pragmas);
  562.     N_LIST(AST(5)) = tup_add(tup_with(N_LIST(AST(3)),
  563.       (char *)AST(4)), N_LIST(AST(5)));
  564.     check_choices(AST(5), "a variant_part");
  565.     node = node_new(as_variant_decl);
  566.     insert_2child(node, AST(1), AST(5));
  567.     nodefree(AST(3));
  568.  
  569.      break;
  570.  /* variant ::= WHEN choice {|choice} => component_list */
  571.  case 67 :
  572.     prepend(AST(1), AST(2));
  573.     node = node_new(as_variant_choices);
  574.     insert_2child(node, AST(2), AST(4));
  575.  
  576.      break;
  577.  /* choice ::= discrete_range */
  578.  case 68 :
  579.     switch(N_KIND(AST(0))) {
  580.         case as_subtype :
  581.         case as_range_attribute :
  582.             node = node_new(as_range_choice);
  583.             insert_1child(node, AST(0));
  584.             break;
  585.         case as_range_expression :
  586.             node = AST(0);
  587.             N_KIND(node) = as_choice_unresolved;
  588.             break;
  589.         default :
  590.             node = node_new(as_simple_choice);
  591.             insert_1child(node, AST(0));
  592.             break;
  593.     }
  594.  
  595.      break;
  596.  /* choice ::= OTHERS */
  597.  case 69 :
  598. {
  599.     Node span_node;
  600.  
  601.     node = node_new(as_others_choice);
  602.     span_node = node_new(as_simple_name);
  603.     N_ID(span_node) = IND(0);
  604.     set_span(span_node, LOC(0));
  605.     insert_3child(node, OPT_NODE, OPT_NODE, span_node);
  606. }
  607.  
  608.      break;
  609.  /* access_type_definition ::= ACCESS subtype_indication */
  610.  case 70 :
  611.     node = node_new(as_access_type);
  612.     insert_1child(node, AST(1));
  613.  
  614.      break;
  615.  /* incomplete_type_declaration ::= TYPE identifier [discriminant_part]; */
  616.  case 71 :
  617.     id_node = make_id(1);
  618.     node = node_new(as_incomplete_decl);
  619.     insert_2child(node, id_node, AST(2));
  620.  
  621.      break;
  622.  /* declarative_part ::= {basic_declarative_item} */
  623.  case 72 :
  624. {
  625.     Tuple decl_list, new_decl_list;
  626.     Node line_node;
  627.     int i, list_length;
  628.     Span line_node_span;
  629.  
  630.     node = AST (0);
  631.     if (N_LIST(node) != (Tuple)0) {
  632.         decl_list = N_LIST(node);
  633.         list_length = tup_size(decl_list);
  634.         new_decl_list = tup_new(0);
  635.  
  636.         for (i = 1; i <= list_length; i++) {
  637.             Node element = (Node)tup_fromb(decl_list);
  638.  
  639.             if (isbody_node[N_KIND(element)]) {
  640.                 new_decl_list = tup_with(new_decl_list, (char *)element);
  641.                 i++;
  642.                 break;
  643.             }
  644.             /* Create and insert as_line_no */
  645.             line_node = node_new (as_line_no);
  646.             line_node_span = get_left_span_p(element);
  647.             N_ID(line_node) = line_node_span->line;
  648.             set_span(line_node, line_node_span);
  649.             new_decl_list = tup_with(new_decl_list, (char *)line_node);
  650.             new_decl_list = tup_with(new_decl_list, (char *)element);
  651.         }
  652.         for ( ; i <= list_length; i++) {
  653.             Node element = (Node)tup_fromb(decl_list);
  654.  
  655.             if (!islater_declarative_node[N_KIND(element)])
  656.                 syntax_err (SPAN (element),
  657.                   "Misplaced basic_declarative_item");
  658.  
  659.             new_decl_list = tup_with(new_decl_list, (char *)element);
  660.         }
  661.         N_LIST(node) = new_decl_list;
  662.     }
  663.     N_KIND(node) = as_declarations;
  664. }
  665.  
  666.  /* basic_declarative_item ::= basic_declaration */
  667.  /* case 73 : */
  668.  
  669.  /* basic_declarative_item ::= representation_clause */
  670.  /* case 74 : */
  671.  
  672.  /* basic_declarative_item ::= use_clause */
  673.  /* case 75 : */
  674.  
  675.  /* basic_declarative_item ::= body */
  676.  /* case 76 : */
  677.  
  678.  /* body ::= proper_body */
  679.  /* case 77 : */
  680.  
  681.  /* body ::= body_stub */
  682.  /* case 78 : */
  683.  
  684.  /* proper_body ::= subprogram_body */
  685.  /* case 79 : */
  686.  
  687.  /* proper_body ::= package_body */
  688.  /* case 80 : */
  689.  
  690.  /* proper_body ::= task_body */
  691.  /* case 81 : */
  692.  
  693.  /* name ::= simple_name */
  694.  /* case 82 : */
  695.  
  696.      break;
  697.  /* name ::= character_literal */
  698.  case 83 :
  699.     node = node_new(as_character_literal);
  700.     N_ID(node) = IND(0);
  701.     set_span(node, LOC(0));
  702.  
  703.      break;
  704.  /* name ::= operator_symbol */
  705.  case 84 :
  706.     node = AST(0);
  707.     N_KIND(node) = as_string;
  708.  
  709.  /* name ::= indexed_component */
  710.  /* case 85 : */
  711.  
  712.  /* name ::= selected_component */
  713.  /* case 86 : */
  714.  
  715.  /* name ::= attribute */
  716.  /* case 87 : */
  717.  
  718.      break;
  719.  /* simple_name ::= identifier */
  720.  case 88 :
  721.     node = node_new(as_simple_name);
  722.     N_ID(node) = IND(0);
  723.     set_span(node, LOC(0));
  724.  
  725.      break;
  726.  /* indexed_component ::= prefix general_aggregate */
  727.  case 89 :
  728. {
  729.     int kind;
  730.     Node arg2 = N_AST3(AST(0));
  731.  
  732.     if (N_KIND(AST(0)) == as_attribute && arg2 == OPT_NODE) {
  733.         /* do the following checks only if have not yet processed the node */
  734.         Node general_component;
  735.         Tuple component_list;
  736.  
  737.         node = AST(0);
  738.         kind = as_opt;
  739.         if (N_LIST(AST(1))&&tup_size(N_LIST(AST(1)))== 1){
  740.             general_component = (Node) N_LIST(AST(1))[1];
  741.             component_list = N_LIST(general_component);
  742.             kind = N_KIND(general_component);
  743.         }
  744.         if (kind == as_opt || kind == as_choice_list || kind == as_range
  745.           || kind == as_subtype) {
  746.             syntax_err(SPAN(AST(1)),
  747.               "Illegal expression for argument of attribute");
  748.             N_AST3(node) = OPT_NODE;
  749.             free_everything(AST(1));
  750.         }
  751.         else {
  752.             N_AST3(node) = general_component;
  753.             nodefree(AST(1));
  754.         }
  755.         N_AST4(node) = NULL;
  756.     }
  757.     else {
  758.         if (N_KIND(AST(0)) == as_string
  759.           && !isoverloadable_op(namelist(N_ID(AST(0))))) {
  760.             char msg[200];
  761.             
  762.             sprintf(msg, "\"%s\" is not a valid operator_symbol",
  763.                 namelist(N_ID(AST(0))));
  764.             syntax_err(SPAN(AST(0)), msg);
  765.         }
  766.         node = node_new(as_call_unresolved);
  767.         insert_2child(node, AST(0), AST(1));
  768.     }
  769. }
  770.  
  771.      break;
  772.  /* selected_component ::= prefix . selector */
  773.  case 90 :
  774.     if (N_KIND(AST(2)) == as_all) {
  775.         node = AST(2);
  776.         insert_1child(node, AST(0));
  777.     }
  778.     else {
  779.         node = node_new(as_selector);
  780.         insert_2child(node, AST(0), AST(2));
  781.     }
  782.  
  783.  /* selector ::= simple_name */
  784.  /* case 91 : */
  785.  
  786.      break;
  787.  /* selector ::= character_literal */
  788.  case 92 :
  789.     node = node_new(as_character_literal);
  790.     N_ID(node) = IND(0);
  791.     set_span(node, LOC(0));
  792.  
  793.      break;
  794.  /* selector ::= operator_symbol */
  795.  case 93 :
  796. {
  797.     char tmp[200];
  798.  
  799.     node = AST(0);
  800.     strcpy(tmp, namelist(N_ID(node)));
  801.     convtolower(tmp);
  802.     if (!isoverloadable_op(tmp)) {
  803.         char msg[300];
  804.         
  805.         sprintf(msg, "\"%s\" is not a valid operator_symbol", tmp);
  806.         syntax_err(get_left_span_p(node), get_right_span_p(node), msg);
  807.     }
  808.     N_ID(node) = namemap(tmp, strlen(tmp));
  809. }
  810.  
  811.      break;
  812.  /* selector ::= ALL */
  813.  case 94 :
  814.     node = node_new(as_all);
  815.  
  816.      break;
  817.  /* attribute ::= prefix ' attribute_designator */
  818.  case 95 :
  819.     node = node_new(as_attribute);
  820.     insert_3child(node, AST(2), AST(0), OPT_NODE);
  821.  
  822.  /* attribute_designator ::= simple_name */
  823.  /* case 96 : */
  824.  
  825.      break;
  826.  /* attribute_designator ::= DIGITS */
  827.  case 97 :
  828.  
  829.  /* attribute_designator ::= DELTA */
  830.  case 98 :
  831.  
  832.  /* attribute_designator ::= RANGE */
  833.  case 99 :
  834.     node = node_new(as_simple_name);
  835.     N_ID(node) = IND(0);
  836.     set_span(node, LOC(0));
  837.  
  838.      break;
  839.  /* aggregate ::= ( component_association {,component_association} ) */
  840.  case 100 :
  841.     if( !tup_size(N_LIST(AST(2)))
  842.       && N_KIND(AST(1)) != as_choice_list){
  843.         node = node_new(as_parenthesis);
  844.         insert_1child(node, AST(1));
  845.         nodefree(AST(2));
  846.     }
  847.     else {
  848.         node = AST(2);
  849.         prepend(AST(1), node);
  850.         N_KIND(node) = as_aggregate;
  851.     }
  852.  
  853.  /* component_association ::= [choice{|choice}=>]expression */
  854.  /* case 101 : */
  855.  
  856.      break;
  857.  /* general_aggregate ::= ( general_component_association {,general_component */
  858.  case 102 :
  859.     node = AST(2);
  860.     prepend(AST(1), node);
  861.  
  862.  /* general_component_association ::= component_association */
  863.  /* case 103 : */
  864.  
  865.      break;
  866.  /* general_component_association ::= simple_expression .. simple_expression */
  867.  case 104 :
  868.     node = node_new(as_range);
  869.     insert_2child(node, AST(0), AST(2));
  870.  
  871.      break;
  872.  /* general_component_association ::= name range_constraint */
  873.  case 105 :
  874.     if (!check_expanded_name(AST(0)))
  875.         syntax_err(SPAN(AST(0)), "subtype_indicaiton must be a type_mark");
  876.     node = node_new(as_subtype);
  877.     insert_2child(node, AST(0), AST(1));
  878.  
  879.  /* expression ::= relation */
  880.  /* case 106 : */
  881.  
  882.  /* expression ::= relation{AND__relation} */
  883.  /* case 107 : */
  884.  
  885.  /* expression ::= relation{OR__relation} */
  886.  /* case 108 : */
  887.  
  888.  /* expression ::= relation{XOR__relation} */
  889.  /* case 109 : */
  890.  
  891.  /* expression ::= relation{AND__THEN__relation} */
  892.  /* case 110 : */
  893.  
  894.  /* expression ::= relation{OR__ELSE__relation} */
  895.  /* case 111 : */
  896.  
  897.      break;
  898.  /* relation ::= simple_expression [relational_operator__simple_expression] */
  899.  case 112 :
  900.     if ((node = AST(1)) == OPT_NODE)
  901.         node = AST(0);
  902.     else {
  903.         Node arg_list_node = N_AST2(node);
  904.         N_LIST(arg_list_node)[1] = (char *) AST(0);
  905.     }
  906.  
  907.      break;
  908.  /* relation ::= simple_expression [NOT] IN range */
  909.  case 113 :
  910. {
  911.     int kind, op_name;
  912.     Node arg_list_node, simple_name;
  913.     Span old_span;
  914.  
  915.     if (AST(1) != OPT_NODE) {
  916.         kind = as_notin;
  917.         op_name = namemap("notin", 5);
  918.     }
  919.     else if (!strcmp(namelist(IND(2)), "any_op"))
  920.         kind = as_any_op;
  921.     else {
  922.         kind = as_in;
  923.         op_name = namemap("in", 2);
  924.     }
  925.     switch (N_KIND(AST(3))) {
  926.         case as_range_expression :
  927.             if (!check_expanded_name(N_AST1(AST(3))))
  928.                 syntax_err(SPAN(AST(3)),
  929.                     "Invalid expression used as range specification");
  930.             break;
  931.         case as_range :
  932.         case as_range_attribute :
  933.             break;
  934.         default :
  935.             syntax_err(SPAN(AST(3)), "Invalid range specification");
  936.             /* fix up to satisfy adasem */
  937.             old_span = LOC(3);
  938.             AST(3) = node_new(as_range_expression);
  939.             insert_1child(AST(3), node_new(as_simple_name));
  940.             N_ID(N_AST1(AST(3))) = namemap("any_id", 6);
  941.             set_span(N_AST1(AST(3)), old_span);
  942.     }
  943.     node = node_new(kind);
  944.     simple_name = node_new(as_simple_name);
  945.     set_span(simple_name, (AST(1) != OPT_NODE ? N_SPAN(AST(1)) : LOC(2)));
  946.     N_ID(simple_name) = op_name;
  947.     arg_list_node = node_new(as_list);
  948.     N_LIST(arg_list_node) = tup_new(2);
  949.     N_LIST(arg_list_node)[1] = (char *)AST(0);
  950.     N_LIST(arg_list_node)[2] = (char *)AST(3);
  951.     insert_2child(node, simple_name, arg_list_node);
  952. }
  953.  
  954.  /* simple_expression ::= [unary_adding_operator]term{binary_adding_operator_ */
  955.  /* case 114 : */
  956.  
  957.  /* term ::= factor{multiplying_operator__factor} */
  958.  /* case 115 : */
  959.  
  960.      break;
  961.  /* factor ::= primary [**__primary] */
  962.  case 116 :
  963.     if ((node = AST(1)) == OPT_NODE)
  964.         node = AST(0);
  965.     else {
  966.         N_LIST(N_AST2(node))[1] = (char *)AST(0);
  967.     }
  968.  
  969.      break;
  970.  /* factor ::= ABS primary */
  971.  case 117 :
  972. {
  973.     Node optr_node;
  974.  
  975.     optr_node = node_new(as_simple_name);
  976.     N_ID(optr_node) = namemap("abs", 3);
  977.     set_span(optr_node, LOC(0));
  978.     node = unary_operator(optr_node, AST(1));
  979. }
  980.  
  981.      break;
  982.  /* factor ::= NOT primary */
  983.  case 118 :
  984. {
  985.     Node optr_node;
  986.  
  987.     optr_node = node_new(as_simple_name);
  988.     N_ID(optr_node) = namemap("not", 3);
  989.     set_span(optr_node, LOC(0));
  990.     node = unary_operator(optr_node, AST(1));
  991. }
  992.  
  993.      break;
  994.  /* primary ::= numeric_literal */
  995.  case 119 :
  996.     node = node_new((strchr(namelist(IND(0)), '.')) ? as_real_literal :
  997.         as_int_literal);
  998.     N_ID(node) = IND(0);
  999.     set_span(node, LOC(0));
  1000.  
  1001.      break;
  1002.  /* primary ::= NULL */
  1003.  case 120 :
  1004.     node = node_new(as_null);
  1005.     set_span(node, LOC(0));
  1006.  
  1007.  /* primary ::= aggregate */
  1008.  /* case 121 : */
  1009.  
  1010.      break;
  1011.  /* primary ::= name */
  1012.  case 122 :
  1013.     if (N_KIND(AST(0)) == as_string) {
  1014.         node = AST(0);
  1015.         N_KIND(node) = as_string_literal;
  1016.     }
  1017.     else {
  1018.         node = node_new(as_name);
  1019.         insert_1child(node, AST(0));
  1020.     }
  1021.  
  1022.  /* primary ::= allocator */
  1023.  /* case 123 : */
  1024.  
  1025.  /* primary ::= qualified_expression */
  1026.  /* case 124 : */
  1027.  
  1028.      break;
  1029.  /* relational_operator ::= = */
  1030.  case 125 :
  1031.  
  1032.  /* relational_operator ::= /= */
  1033.  case 126 :
  1034.  
  1035.  /* relational_operator ::= < */
  1036.  case 127 :
  1037.  
  1038.  /* relational_operator ::= <= */
  1039.  case 128 :
  1040.  
  1041.  /* relational_operator ::= > */
  1042.  case 129 :
  1043.  
  1044.  /* relational_operator ::= >= */
  1045.  case 130 :
  1046.  
  1047.  /* binary_adding_operator ::= + */
  1048.  case 131 :
  1049.  
  1050.  /* binary_adding_operator ::= - */
  1051.  case 132 :
  1052.  
  1053.  /* binary_adding_operator ::= & */
  1054.  case 133 :
  1055.     node = node_new(as_simple_name);
  1056.     N_ID(node) = IND(0);
  1057.     set_span(node, LOC(0));
  1058.  
  1059.      break;
  1060.  /* unary_adding_operator ::= + */
  1061.  case 134 :
  1062.  
  1063.  /* unary_adding_operator ::= - */
  1064.  case 135 :
  1065. {
  1066.     char str[6];
  1067.  
  1068.     node = node_new(as_simple_name);
  1069.     sprintf(str, "%s", namelist(IND(0)));
  1070.     N_ID(node) = namemap(str, 1);
  1071.     set_span(node, LOC(0));
  1072. }
  1073.  
  1074.      break;
  1075.  /* multiplying_operator ::= * */
  1076.  case 136 :
  1077.  
  1078.  /* multiplying_operator ::= / */
  1079.  case 137 :
  1080.     node = node_new(as_simple_name);
  1081.     N_ID(node) = IND(0);
  1082.     set_span(node, LOC(0));
  1083.  
  1084.      break;
  1085.  /* multiplying_operator ::= MOD */
  1086.  case 138 :
  1087.     node = node_new(as_simple_name);
  1088.     N_ID(node) = namemap("mod", 3);
  1089.     set_span(node, LOC(0));
  1090.  
  1091.      break;
  1092.  /* multiplying_operator ::= REM */
  1093.  case 139 :
  1094.     node = node_new(as_simple_name);
  1095.     N_ID(node) =  namemap("rem", 3);
  1096.     set_span(node, LOC(0));
  1097.  
  1098.      break;
  1099.  /* qualified_expression ::= name ' aggregate */
  1100.  case 140 :
  1101.     if (!check_expanded_name(AST(0)))
  1102.         syntax_err(SPAN(AST(0)),
  1103.               "Invalid type_mark found in qualified_expression");
  1104.     if (N_KIND(AST(2)) == as_parenthesis) { /* remove parentheses */
  1105.         AST(2) = N_AST1(AST(2));
  1106.     }
  1107.     node = node_new(as_qualify);
  1108.     insert_2child(node, AST(0), AST(2));
  1109.  
  1110.      break;
  1111.  /* allocator ::= NEW type_mark */
  1112.  case 141 :
  1113.     node = node_new(as_new);
  1114.     insert_2child(node, AST(1), OPT_NODE);
  1115.  
  1116.      break;
  1117.  /* allocator ::= NEW type_mark general_aggregate */
  1118.  case 142 :
  1119.     node = node_new(as_new);
  1120.     insert_2child(node, AST(1), AST(2));
  1121.  
  1122.      break;
  1123.  /* allocator ::= NEW type_mark ' aggregate */
  1124.  case 143 :
  1125.     node = node_new(as_new_init);
  1126.     insert_2child(node, AST(1), AST(3));
  1127.  
  1128.      break;
  1129.  /* sequence_of_statements ::= {pragma} statement {statement} */
  1130.  case 144 :
  1131. {
  1132.     Node label_list_node,  line_node;
  1133.     Tuple nodelabels = tup_new(0);
  1134.     Tuple lablistlabels = tup_new(0);
  1135.     Tuple new_statement_list, tmp_list;
  1136.     Span line_node_span;
  1137.  
  1138.     check_pragmas(AST(0), null_pragmas);
  1139.     node = node_new(as_statements);
  1140.     new_statement_list = tup_new1((char *)AST(1));
  1141.     if (N_LIST(AST(0)) != (Tuple)0)
  1142.         new_statement_list = tup_add(N_LIST(AST(0)), new_statement_list);
  1143.     if (N_LIST(AST(2)) == (Tuple)0)
  1144.         N_LIST(AST(2)) = new_statement_list;
  1145.     else
  1146.         N_LIST(AST(2)) = tup_add(new_statement_list, N_LIST(AST(2)));
  1147.     label_list_node = node_new(as_list);
  1148.     new_statement_list = tup_new(0);
  1149.     FORTUP (tmp_node = (Node), N_LIST(AST(2)), ft1);
  1150.         if (tmp_list = getlabels(tmp_node))
  1151.             nodelabels = tup_add(nodelabels, tmp_list);
  1152.         if (N_KIND(tmp_node) == as_statement)
  1153.             if (tmp_list = N_LIST(N_AST1(tmp_node)))
  1154.                 lablistlabels = tup_add(lablistlabels, tmp_list);
  1155.         if(N_KIND(tmp_node) != as_pragma) {
  1156.             /* insert as_line_no node before the current node (tmp_node) */
  1157.             line_node = node_new(as_line_no);
  1158.             line_node_span = get_left_span_p(tmp_node);
  1159.             N_ID(line_node) = line_node_span->line;
  1160.             set_span(line_node, line_node_span);
  1161.             new_statement_list = tup_with(new_statement_list,(char *)line_node);
  1162.         }
  1163.         new_statement_list = tup_with(new_statement_list, (char *)tmp_node);
  1164.     ENDFORTUP(ft1);
  1165.     N_LIST(AST(2)) = new_statement_list;
  1166.     /* add as_line_no node for next token (curtok) to end of stmt_list */
  1167.     end_as_line_no(AST(2), curtok);
  1168.     newlabels(node, nodelabels);
  1169.     N_LIST(label_list_node) = lablistlabels;
  1170.     if (!(tup_size(lablistlabels)))
  1171.         set_span(label_list_node, &curtok->ptr.token->span);
  1172.     insert_2child(node, AST(2), label_list_node);
  1173.     nodefree(AST(0));
  1174. }
  1175.  
  1176.      break;
  1177.  /* statement ::= {label} simple_statement */
  1178.  case 145 :
  1179.     if (tup_size(N_LIST(AST(0)))) {
  1180.         node = node_new(as_statement);
  1181.         insert_2child(node, AST(0), AST(1));
  1182.         newlabels(node, tup_copy(N_LIST(AST(0))));
  1183.     }
  1184.     else {
  1185.         node = AST(1);
  1186.         nodefree(AST(0));
  1187.     }
  1188.  
  1189.      break;
  1190.  /* statement ::= {label} compound_statement */
  1191.  case 146 :
  1192.     if (tup_size(N_LIST(AST(0)))) {
  1193.         node = node_new(as_statement);
  1194.         insert_2child(node, AST(0), AST(1));
  1195.         newlabels(node, tup_add(N_LIST(AST(0)), getlabels(AST(1))));
  1196.     }
  1197.     else {
  1198.         node = AST(1);
  1199.         nodefree(AST(0));
  1200.     }
  1201.  
  1202.  /* simple_statement ::= null_statement */
  1203.  /* case 147 : */
  1204.  
  1205.  /* simple_statement ::= assignment_statement */
  1206.  /* case 148 : */
  1207.  
  1208.  /* simple_statement ::= exit_statement */
  1209.  /* case 149 : */
  1210.  
  1211.  /* simple_statement ::= return_statement */
  1212.  /* case 150 : */
  1213.  
  1214.  /* simple_statement ::= goto_statement */
  1215.  /* case 151 : */
  1216.  
  1217.  /* simple_statement ::= delay_statement */
  1218.  /* case 152 : */
  1219.  
  1220.  /* simple_statement ::= abort_statement */
  1221.  /* case 153 : */
  1222.  
  1223.  /* simple_statement ::= raise_statement */
  1224.  /* case 154 : */
  1225.  
  1226.  /* simple_statement ::= code_statement */
  1227.  /* case 155 : */
  1228.  
  1229.  /* simple_statement ::= call_statement */
  1230.  /* case 156 : */
  1231.  
  1232.  /* compound_statement ::= if_statement */
  1233.  /* case 157 : */
  1234.  
  1235.  /* compound_statement ::= case_statement */
  1236.  /* case 158 : */
  1237.  
  1238.  /* compound_statement ::= loop_statement */
  1239.  /* case 159 : */
  1240.  
  1241.  /* compound_statement ::= block_statement */
  1242.  /* case 160 : */
  1243.  
  1244.  /* compound_statement ::= accept_statement */
  1245.  /* case 161 : */
  1246.  
  1247.  /* compound_statement ::= select_statement */
  1248.  /* case 162 : */
  1249.  
  1250.      break;
  1251.  /* label ::= << label_simple_name >> */
  1252.  case 163 :
  1253.     node = AST(1);
  1254.  
  1255.      break;
  1256.  /* null_statement ::= NULL ; */
  1257.  case 164 :
  1258.     node = node_new(as_null_s);
  1259.     set_span(node, LOC(0));
  1260.  
  1261.      break;
  1262.  /* assignment_statement ::= variable_name := expression ; */
  1263.  case 165 :
  1264.     node = node_new(as_assignment);
  1265.     insert_2child(node, AST(0), AST(2));
  1266.  
  1267.      break;
  1268.  /* if_statement ::= IF condition THEN sequence_of_statements {ELSIF__conditi */
  1269.  case 166 :
  1270. {
  1271.     Node if_node;
  1272.     Tuple nodelabels = tup_new(0);
  1273.     
  1274.     node = node_new(as_if);
  1275.     if_node = node_new(as_cond_statements);
  1276.     insert_2child(if_node, AST(1), AST(3));
  1277.     prepend(if_node, AST(4));
  1278.     FORTUP(tmp_node = (Node), N_LIST(AST(4)), ft1);
  1279.         nodelabels = tup_add(nodelabels, getlabels(N_AST2(tmp_node)));
  1280.     ENDFORTUP(ft1);
  1281.     if (AST(5) != OPT_NODE)
  1282.         nodelabels = tup_add(nodelabels, getlabels(AST(5)));
  1283.     newlabels(node, nodelabels);
  1284.     insert_2child(node, AST(4), AST(5));
  1285. }
  1286.  
  1287.      break;
  1288.  /* condition ::= boolean_expression */
  1289.  case 167 :
  1290.     node = node_new(as_condition);
  1291.     insert_1child(node, AST(0));
  1292.  
  1293.      break;
  1294.  /* case_statement ::= CASE expression IS {pragma} case_statement_alternative */
  1295.  case 168 :
  1296. {
  1297.     Tuple nodelabels = tup_new(0);
  1298.  
  1299.     node = node_new(as_case);
  1300.     check_pragmas(AST(3), null_pragmas);
  1301.     N_LIST(AST(5)) = tup_add(tup_with(N_LIST(AST(3)), (char *)AST(4)),
  1302.       N_LIST(AST(5)));
  1303.     check_choices(AST(5), "a case_statement");
  1304.     nodefree(AST(3));
  1305.     FORTUP(tmp_node = (Node), N_LIST(AST(5)), ft1);
  1306.         nodelabels = tup_add(nodelabels, getlabels(N_AST2(tmp_node)));
  1307.     ENDFORTUP(ft1);
  1308.     newlabels(node, nodelabels);
  1309.     insert_2child(node, AST(1), AST(5));
  1310. }
  1311.  
  1312.      break;
  1313.  /* case_statement_alternative ::= WHEN choice {|choice} => sequence_of_state */
  1314.  case 169 :
  1315.     prepend(AST(1), AST(2));
  1316.     node = node_new(as_case_statements);
  1317.     insert_2child(node, AST(2), AST(4));
  1318.  
  1319.      break;
  1320.  /* loop_statement ::= [loop_simple_name:] [iteration_scheme] LOOP sequence_o */
  1321.  case 170 :
  1322. {
  1323.     Node simple_name1;
  1324.     Span left_span, right_span ;
  1325.  
  1326.     simple_name1 = AST(0);
  1327.     if (simple_name1 != OPT_NODE)
  1328.     left_span = get_left_span_p(simple_name1);
  1329.     else if (AST(1) != OPT_NODE)
  1330.     left_span = get_left_span_p(AST(1));
  1331.     else left_span = LOC(2);
  1332.     if (AST(6) != OPT_NODE)
  1333.     right_span = get_right_span_p(AST(6));
  1334.     else right_span = END_LOC(5);
  1335.     node = node_new(as_loop);
  1336.     if (simple_name1 != OPT_NODE) {
  1337.         if (AST(6) != OPT_NODE) {
  1338.             if (N_ID(simple_name1) != N_ID(AST(6)))
  1339.                 match_error(N_ID(simple_name1), N_ID(AST(6)),
  1340.                   "loop_statement", left_span, right_span);
  1341.         }
  1342.         else {
  1343.             char msg[200];
  1344.  
  1345.            sprintf(msg,
  1346. "%s at beginning of loop_statement does not match non-existent \
  1347. \"loop_simple_name\" at END LOOP", namelist(N_ID(simple_name1)));
  1348.            syntax_err(left_span, right_span, msg);
  1349.        }
  1350.     }
  1351.     else {
  1352.         char newlabel[15];
  1353.  
  1354.         if (AST(6) != OPT_NODE) {
  1355.             char msg[200];
  1356.         
  1357.             sprintf(msg,
  1358. "Non existent \"loop_simple_name:\" at beginning of loop_statement does \
  1359. not match %s", namelist(N_ID(AST(6))));
  1360.             syntax_err(left_span, right_span, msg);
  1361.         }
  1362.         simple_name1 = node_new(as_simple_name);
  1363.         sprintf(newlabel, "#%x", simple_name1);
  1364.         N_ID(simple_name1) = namemap(newlabel, strlen(newlabel));
  1365.      set_span(simple_name1, left_span);
  1366.     }
  1367.     newlabels(node, tup_add(tup_new1((char *)simple_name1),
  1368.         getlabels(AST(3))));
  1369.     insert_3child(node, simple_name1, AST(1), AST(3));
  1370.  
  1371.     nodefree(AST(6));
  1372. }
  1373.  
  1374.      break;
  1375.  /* iteration_scheme ::= WHILE condition */
  1376.  case 171 :
  1377.     node = node_new(as_while);
  1378.     insert_1child(node, AST(1));
  1379.  
  1380.      break;
  1381.  /* iteration_scheme ::= FOR loop_parameter_specification */
  1382.  case 172 :
  1383.     node = AST(1);
  1384.  
  1385.      break;
  1386.  /* loop_parameter_specification ::= identifier IN [REVERSE] discrete_range */
  1387.  case 173 :
  1388.     check_discrete_range(AST(3));
  1389.     node = node_new((AST(2) == OPT_NODE) ? as_for : as_forrev);
  1390.     id_node = make_id(0);
  1391.     insert_2child(node, id_node, AST(3));
  1392.  
  1393.      break;
  1394.  /* block_statement ::= [block_simple_name:] [DECLARE__declarative_part] BEGI */
  1395.  case 174 :
  1396. {
  1397.     Node simple_name1, labs_node;
  1398.     Span left_span, right_span ;
  1399.  
  1400.     simple_name1 = AST(0);
  1401.     if (simple_name1 != OPT_NODE)
  1402.     left_span = get_left_span_p(simple_name1);
  1403.     else if (AST(1) != OPT_NODE)
  1404.     left_span = get_left_span_p(AST(1));
  1405.     else left_span = LOC(2);
  1406.     if (AST(6) != OPT_NODE)
  1407.     right_span = get_right_span_p(AST(6));
  1408.     else right_span = END_LOC(5);
  1409.     
  1410.     node = node_new(as_block);
  1411.     if (simple_name1 != OPT_NODE) {
  1412.         if (AST(6) != OPT_NODE) {
  1413.             if (N_ID(simple_name1) != N_ID(AST(6)))
  1414.                 match_error(N_ID(simple_name1), N_ID(AST(6)),
  1415.                   "block_statement", left_span, right_span);
  1416.         }
  1417.         else {
  1418.             char msg[200];
  1419.             
  1420.             sprintf(msg,
  1421. "%s at beginning of block_statement does not match non-existent \
  1422. \"block_simple_name\" at end of block", namelist(N_ID(simple_name1)));
  1423.             syntax_err(left_span, right_span, msg);
  1424.         }
  1425.     }
  1426.     else {
  1427.         char newlabel[15];
  1428.  
  1429.         if (AST(6) != OPT_NODE) {
  1430.             char msg[200];
  1431.         
  1432.             sprintf(msg,
  1433. "Non-existent \"block_simple_name:\" at beginning of block_statement does \
  1434. not match %s", namelist(N_ID(AST(6))));
  1435.             syntax_err(get_left_span_p(AST(6)),
  1436.             get_right_span_p(AST(6)), msg);
  1437.         }
  1438.         simple_name1 = node_new(as_simple_name);
  1439.         sprintf(newlabel, "#%x", simple_name1);
  1440.         N_ID(simple_name1) = namemap(newlabel, strlen(newlabel));
  1441.          set_span(simple_name1, left_span);
  1442.     }
  1443.  
  1444.     /* The labels declared within a block are grouped together under a single
  1445.        node : labs_node.  This node is then passed upwards to help prevent
  1446.        duplicate declaration of labels within a program unit.
  1447.        (see remove_duplicate_labels)
  1448.     */
  1449.  
  1450.     labs_node = node_new(as_labels);
  1451.     N_LIST(labs_node) = remove_duplicate_labels(tup_add(getlabels(AST(3)),
  1452.       ((AST(4)==OPT_NODE) ? tup_new(0):(getlabels(AST(4))))));
  1453.     newlabels(node, tup_new2((char *)simple_name1, (char *)labs_node));
  1454.     append(AST(1), labs_node);
  1455.     insert_4child(node, simple_name1, AST(1), AST(3), AST(4));
  1456.     nodefree(AST(6));
  1457. }
  1458.  
  1459.      break;
  1460.  /* exit_statement ::= EXIT [loop_name] [WHEN__condition] ; */
  1461.  case 175 :
  1462. {
  1463.     Node span_node;
  1464.  
  1465.     node = node_new(as_exit);
  1466.     span_node = node_new(as_simple_name);
  1467.     N_ID(span_node) = IND(0);
  1468.     set_span(span_node, LOC(0));
  1469.     insert_4child(node, AST(1), AST(2), OPT_NODE, span_node);
  1470. }
  1471.  
  1472.      break;
  1473.  /* return_statement ::= RETURN [expression] ; */
  1474.  case 176 :
  1475. {
  1476.     Node span_node;
  1477.  
  1478.     node = node_new(as_return);
  1479.     span_node = node_new(as_simple_name);
  1480.     N_ID(span_node) = IND(0);
  1481.     set_span(span_node, LOC(0));
  1482.     insert_4child(node, AST(1), OPT_NODE, OPT_NODE, span_node);
  1483. }
  1484.  
  1485.      break;
  1486.  /* goto_statement ::= GOTO label_name ; */
  1487.  case 177 :
  1488.     node = node_new(as_goto);
  1489.     insert_1child(node, AST(1));
  1490.  
  1491.      break;
  1492.  /* subprogram_declaration ::= subprogram_specification ; */
  1493.  case 178 :
  1494.     node = node_new(as_subprogram_decl);
  1495.     insert_1child(node, AST(0));
  1496.  
  1497.      break;
  1498.  /* subprogram_specification ::= PROCEDURE identifier [formal_part] */
  1499.  case 179 :
  1500.     id_node = make_id(1);
  1501.     node = node_new(as_procedure);
  1502.     insert_3child(node, id_node, AST(2), OPT_NODE);
  1503.  
  1504.      break;
  1505.  /* subprogram_specification ::= FUNCTION designator [formal_part] RETURN typ */
  1506.  case 180 :
  1507.     node = node_new(as_function);
  1508.     insert_3child(node, AST(1), AST(2), AST(4));
  1509.  
  1510.      break;
  1511.  /* designator ::= identifier */
  1512.  case 181 :
  1513.     node = node_new(as_simple_name);
  1514.     N_ID(node) = IND(0);
  1515.     set_span(node, LOC(0));
  1516.  
  1517.      break;
  1518.  /* designator ::= operator_symbol */
  1519.  case 182 :
  1520. {
  1521.     char tmp[200];
  1522.  
  1523.     node = AST(0);
  1524.     strcpy(tmp, namelist(N_ID(node)));
  1525.     convtolower(tmp);
  1526.     if (!isoverloadable_op(tmp)) {
  1527.         char msg[300];
  1528.         
  1529.         sprintf(msg, "\"%s\" is not a valid operator_symbol", tmp);
  1530.         syntax_err(get_left_span_p(node), get_right_span_p(node), msg);
  1531.     }
  1532.     N_ID(node) = namemap(tmp, strlen(tmp));
  1533. }
  1534.  
  1535.      break;
  1536.  /* operator_symbol ::= string_literal */
  1537.  case 183 :
  1538.     node = node_new(as_operator);
  1539.     N_ID(node) = IND(0);
  1540.     set_span(node, LOC(0));
  1541.  
  1542.      break;
  1543.  /* formal_part ::= ( parameter_specification {;parameter_specification} ) */
  1544.  case 184 :
  1545.     node = AST(2);
  1546.     prepend(AST(1), node);
  1547.  
  1548.      break;
  1549.  /* parameter_specification ::= identifier_list : mode type_mark [:=expressio */
  1550.  case 185 :
  1551.     node = node_new(as_formal);
  1552.     insert_4child(node, AST(0), AST(2), AST(3), AST(4));
  1553.  
  1554.  /* mode ::= [IN] */
  1555.  /* case 186 : */
  1556.  
  1557.      break;
  1558.  /* mode ::= IN OUT */
  1559.  case 187 :
  1560.     node = node_new(as_mode);
  1561.     N_ID(node) = namemap("inout", 5);
  1562.     set_span(node, LOC(0));
  1563.  
  1564.      break;
  1565.  /* mode ::= OUT */
  1566.  case 188 :
  1567.     node = node_new(as_mode);
  1568.     N_ID(node) = namemap("out", 3);
  1569.     set_span(node, LOC(0));
  1570.  
  1571.      break;
  1572.  /* subprogram_body ::= subprogram_specification IS declarative_part BEGIN se */
  1573.  case 189 :
  1574. {
  1575.     Node labs_node;
  1576.  
  1577.     if (AST(7) != OPT_NODE && N_ID(N_AST1(AST(0))) != N_ID(AST(7)))
  1578.         match_error(N_ID(N_AST1(AST(0))), N_ID(AST(7)), "subprogram_body",
  1579.         get_left_span_p(AST(0)), get_right_span_p(AST(7)));
  1580.     nodefree(AST(7));
  1581.     labs_node = node_new(as_labels);
  1582.     N_LIST(labs_node) = remove_duplicate_labels(tup_add(getlabels(AST(4)),
  1583.       ((AST(5)==OPT_NODE) ? tup_new(0) : getlabels(AST(5)))));
  1584.     append(AST(2), labs_node);
  1585.     node = node_new(as_subprogram);
  1586.     insert_4child(node, AST(0), AST(2), AST(4), AST(5));
  1587. }
  1588.  
  1589.      break;
  1590.  /* call_statement ::= name ; */
  1591.  case 190 :
  1592.     node = node_new(as_call);
  1593.     insert_1child(node, AST(0));
  1594.  
  1595.      break;
  1596.  /* package_declaration ::= package_specification ; */
  1597.  case 191 :
  1598.     node = AST(0);
  1599.  
  1600.      break;
  1601.  /* package_specification ::= PACKAGE identifier IS {basic_declarative_item}  */
  1602.  case 192 :
  1603.     if (AST(6) != OPT_NODE && IND(1) != N_ID(AST(6)))
  1604.         match_error(IND(1), N_ID(AST(6)), "package_specification",
  1605.           get_left_span_p(AST(6)), get_right_span_p(AST(6)));
  1606.     id_node = make_id(1);
  1607.     FORTUP(tmp_node = (Node), N_LIST(AST(3)), ft1);
  1608.         if (isbody_node[N_KIND(tmp_node)])
  1609.             syntax_err(SPAN(tmp_node),
  1610.                 "Body declaration not allowed in package_specification");
  1611.     ENDFORTUP(ft1);
  1612.     N_KIND(AST(3)) = as_declarations;
  1613.     ins_as_line_no(AST(3));
  1614.     node = node_new(as_package_spec);
  1615.     insert_3child(node, id_node, AST(3), AST(4));
  1616.     nodefree(AST(6));
  1617.  
  1618.      break;
  1619.  /* package_body ::= PACKAGE BODY package_simple_name IS declarative_part END */
  1620.  case 193 :
  1621.     if (AST(6) != OPT_NODE
  1622.       && N_ID(AST(2)) != N_ID(AST(6)))
  1623.         match_error(N_ID(AST(2)), N_ID(AST(6)),
  1624.           "package_body", get_left_span_p(AST(6)),
  1625.           get_right_span_p(AST(6)));
  1626.     node = node_new(as_package_body);
  1627.     insert_4child(node, AST(2), AST(4), OPT_NODE, OPT_NODE);
  1628.     nodefree(AST(6));
  1629.  
  1630.      break;
  1631.  /* package_body ::= PACKAGE BODY package_simple_name IS declarative_part BEG */
  1632.  case 194 :
  1633. {
  1634.     Node labs_node;
  1635.     
  1636.     if (AST(9) != OPT_NODE
  1637.       && N_ID(AST(2)) != N_ID(AST(9)))
  1638.         match_error(N_ID(AST(2)), N_ID(AST(9)),
  1639.           "package_body", get_left_span_p(AST(9)),
  1640.           get_right_span_p(AST(9)));
  1641.     labs_node = node_new(as_labels);
  1642.     N_LIST(labs_node) = remove_duplicate_labels( tup_add(getlabels(AST(6)),
  1643.       ((AST(7)==OPT_NODE) ? tup_new(0) : getlabels(AST(7)))));
  1644.     append(AST(4), labs_node);
  1645.     node = node_new(as_package_body);
  1646.     insert_4child(node, AST(2), AST(4), AST(6), AST(7));
  1647.     nodefree(AST(9));
  1648. }
  1649.  
  1650.      break;
  1651.  /* private_type_declaration ::= TYPE identifier [discriminant_part]IS [LIMIT */
  1652.  case 195 :
  1653. {
  1654.     Node kind_node;
  1655.     
  1656.     id_node = make_id(1);
  1657.     kind_node = node_new(as_simple_name);
  1658.     N_ID(kind_node) = (AST(3) == OPT_NODE) ? namemap("private", 7) :
  1659.         namemap("limited_private", 15);
  1660.     set_span(kind_node,(AST(3)==OPT_NODE ? LOC(4) : N_SPAN(AST(3))));
  1661.     node = node_new(as_private_decl);
  1662.     insert_3child(node, id_node, AST(2), kind_node);
  1663. }
  1664.  
  1665.      break;
  1666.  /* use_clause ::= USE package_name {,package_name} ; */
  1667.  case 196 :
  1668.     node = AST(2);
  1669.     prepend(AST(1), node);
  1670.     N_KIND(node) = as_use;
  1671.  
  1672.      break;
  1673.  /* renaming_declaration ::= identifier:type_mark RENAMES object_name ; */
  1674.  case 197 :
  1675.     node = AST(0);
  1676.     N_AST3(node) = AST(2);
  1677.  
  1678.      break;
  1679.  /* renaming_declaration ::= identifier:EXCEPTION RENAMES exception_name ; */
  1680.  case 198 :
  1681.     node = AST(0);
  1682.     N_AST2(node) = AST(2);
  1683.  
  1684.      break;
  1685.  /* renaming_declaration ::= PACKAGE identifier RENAMES package_name ; */
  1686.  case 199 :
  1687.     id_node = make_id(1);
  1688.     node = node_new(as_rename_pack);
  1689.     insert_2child(node, id_node, AST(3));
  1690.  
  1691.      break;
  1692.  /* renaming_declaration ::= subprogram_specification RENAMES subprogram_or_e */
  1693.  case 200 :
  1694.     node = node_new(as_rename_sub);
  1695.     insert_2child(node, AST(0), AST(2));
  1696.  
  1697.      break;
  1698.  /* task_declaration ::= task_specification ; */
  1699.  case 201 :
  1700.     node = AST(0);
  1701.  
  1702.      break;
  1703.  /* task_specification ::= TASK [TYPE] identifier */
  1704.  case 202 :
  1705. {
  1706.     Node entry_decl_list, repr_clause_list;
  1707.  
  1708.     id_node = make_id(2);
  1709.     node = node_new((AST(1) == OPT_NODE) ? as_task_spec : as_task_type_spec);
  1710.     entry_decl_list = node_new(as_list);
  1711.     repr_clause_list = node_new(as_list);
  1712.     N_LIST(entry_decl_list) = tup_new(0);
  1713.     N_LIST(repr_clause_list) = tup_new(0);
  1714.     set_span(entry_decl_list, &curtok->ptr.token->span);
  1715.     set_span(repr_clause_list, &curtok->ptr.token->span);
  1716.     insert_3child(node, id_node, entry_decl_list, repr_clause_list);
  1717. }
  1718.  
  1719.      break;
  1720.  /* task_specification ::= TASK [TYPE] identifier IS {entry_declaration} {rep */
  1721.  case 203 :
  1722.     if (AST(7) != OPT_NODE && N_ID(AST(7)) != IND(2))
  1723.         match_error(IND(2), N_ID(AST(7)), "task_specification",
  1724.           get_left_span_p(AST(7)), get_right_span_p(AST(7)));
  1725.     id_node = make_id(2);
  1726.     node = node_new((AST(1) == OPT_NODE) ? as_task_spec : as_task_type_spec);
  1727.     insert_3child(node, id_node, AST(4), AST(5));
  1728.     ins_as_line_no(AST(4));
  1729.     nodefree(AST(7));
  1730.  
  1731.      break;
  1732.  /* task_body ::= TASK BODY task_simple_name IS declarative_part BEGIN sequen */
  1733.  case 204 :
  1734. {
  1735.     Node labs_node;
  1736.  
  1737.     if (AST(9) != OPT_NODE
  1738.       && N_ID(AST(2)) != N_ID(AST(9)))
  1739.         match_error(N_ID(AST(2)), N_ID(AST(9)),
  1740.           "task_body", get_left_span_p(AST(9)),
  1741.           get_right_span_p(AST(9)));
  1742.     labs_node = node_new(as_labels);
  1743.     N_LIST(labs_node) = remove_duplicate_labels( tup_add(getlabels(AST(6)),
  1744.       ((AST(7)==OPT_NODE) ? tup_new(0) : getlabels(AST(7)))));
  1745.     append(AST(4), labs_node);
  1746.     node = node_new(as_task);
  1747.     insert_4child(node, AST(2), AST(4), AST(6), AST(7));
  1748.     nodefree(AST(9));
  1749. }
  1750.  
  1751.      break;
  1752.  /* entry_declaration ::= ENTRY identifier [(discrete_range)][formal_part] ; */
  1753.  case 205 :
  1754.     node = AST(2);
  1755.     id_node = make_id(1);
  1756.     N_AST1(node) = id_node;
  1757.  
  1758.      break;
  1759.  /* accept_statement ::= ACCEPT entry_simple_name [(entry_index)][formal_part */
  1760.  case 206 :
  1761.     node = AST(2);
  1762.     erase_labels(node);
  1763.     N_AST1(node) = AST(1);
  1764.     N_AST4(node) = OPT_NODE;
  1765.  
  1766.      break;
  1767.  /* accept_statement ::= ACCEPT entry_simple_name [(entry_index)][formal_part */
  1768.  case 207 :
  1769.     node = AST(2);
  1770.     if (AST(6) != OPT_NODE
  1771.       && N_ID(AST(1)) != N_ID(AST(6)))
  1772.         match_error(N_ID(AST(1)), N_ID(AST(6)),
  1773.           "accept_statement", get_left_span_p(AST(6)),
  1774.           get_right_span_p(AST(6)));
  1775.     newlabels(node, tup_copy(getlabels(AST(4))));
  1776.     N_AST1(node) = AST(1);
  1777.     N_AST4(node) = AST(4);
  1778.     nodefree(AST(6));
  1779.  
  1780.  /* entry_index ::= expression */
  1781.  /* case 208 : */
  1782.  
  1783.      break;
  1784.  /* delay_statement ::= DELAY simple_expression ; */
  1785.  case 209 :
  1786.     node = node_new(as_delay);
  1787.     insert_1child(node, AST(1));
  1788.  
  1789.  /* select_statement ::= selective_wait */
  1790.  /* case 210 : */
  1791.  
  1792.  /* select_statement ::= conditional_entry_call */
  1793.  /* case 211 : */
  1794.  
  1795.  /* select_statement ::= timed_entry_call */
  1796.  /* case 212 : */
  1797.  
  1798.      break;
  1799.  /* selective_wait ::= SELECT {pragma} select_alternative {OR__select_alterna */
  1800.  case 213 :
  1801. {
  1802.     Tuple nodelabels = tup_new(0);
  1803.     int delay_index = 0, terminate_index = 0, has_accept = 0, i = 0;
  1804.     int terminate_ct = 0;
  1805.     Node delay_ptr = NULL, terminate_ptr = NULL, tmp_alt;
  1806.  
  1807.     node = node_new(as_selective_wait);
  1808.     check_pragmas(AST(1), null_pragmas);
  1809.     N_LIST(AST(3)) = tup_add(tup_with(N_LIST(AST(1)), (char *)AST(2)),
  1810.       N_LIST(AST(3)));
  1811.     FORTUP(tmp_node = (Node), N_LIST(AST(3)), ft1);
  1812.       nodelabels = tup_add(nodelabels, getlabels(tmp_node));
  1813.     ENDFORTUP(ft1);
  1814.     if (AST(4) != OPT_NODE)
  1815.         nodelabels = tup_add(nodelabels, getlabels(AST(4)));
  1816.     newlabels(node, nodelabels);
  1817.     insert_2child(node, AST(3), AST(4));
  1818.     nodefree(AST(1));
  1819.  
  1820.     FORTUP(tmp_node = (Node), N_LIST(AST(3)), ft1);
  1821.         i++;
  1822.         if (N_KIND(tmp_alt = tmp_node) == as_guard)
  1823.             tmp_alt = N_AST2(tmp_alt);
  1824.         if (N_KIND(tmp_alt) == as_delay_alt) {
  1825.             delay_index = i;
  1826.             delay_ptr = tmp_alt;
  1827.         }
  1828.         else if (N_KIND(tmp_alt) == as_terminate_alt) {
  1829.             terminate_index = i;
  1830.             terminate_ptr = tmp_alt;
  1831.             if (++terminate_ct > 1)
  1832.                 syntax_err(SPAN(terminate_ptr),
  1833.      "Only one terminate alternative can appear in a SELECT statement");
  1834.         }
  1835.         else
  1836.             has_accept = 1;
  1837.     ENDFORTUP(ft1);
  1838.     if (delay_index && terminate_index) {
  1839.         tmp_alt = (delay_index > terminate_index) ? delay_ptr : 
  1840.           terminate_ptr;
  1841.         syntax_err(SPAN(tmp_alt),
  1842. "Delay and terminate alternatives cannot appear in the same SELECT statement");
  1843.     }
  1844.     if ((delay_index || terminate_index) && AST(4) != OPT_NODE)
  1845.         syntax_err(SPAN(AST(4)),
  1846.           "ELSE part cannot appear in SELECT statement if delay or terminate \
  1847. alternatives are present");
  1848.  
  1849.     /* A selective_wait must contain at least one accept_alternative */
  1850.     if (!has_accept)
  1851.         syntax_err(LOC(0), END_LOC(6),
  1852.           "SELECT statement must have at least one ACCEPT alternative");
  1853. }
  1854.  
  1855.      break;
  1856.  /* select_alternative ::= [WHEN__condition=>] selective_wait_alternative */
  1857.  case 214 :
  1858.     if (AST(0) == OPT_NODE)
  1859.         node = AST(1);
  1860.     else {
  1861.         node = node_new(as_guard);
  1862.         newlabels(node, tup_copy(getlabels(AST(1))));
  1863.         insert_2child(node, AST(0), AST(1));
  1864.     }
  1865.  
  1866.  /* selective_wait_alternative ::= accept_alternative */
  1867.  /* case 215 : */
  1868.  
  1869.  /* selective_wait_alternative ::= delay_alternative */
  1870.  /* case 216 : */
  1871.  
  1872.  /* selective_wait_alternative ::= terminate_alternative */
  1873.  /* case 217 : */
  1874.  
  1875.      break;
  1876.  /* accept_alternative ::= accept_statement [sequence_of_statements] */
  1877.  case 218 :
  1878.     node = node_new(as_accept_alt);
  1879.     if (AST(1)!=OPT_NODE) {
  1880.         newlabels(node, tup_add(getlabels(AST(0)), getlabels(AST(1))));
  1881.     }
  1882.     else {
  1883.         newlabels(node, tup_copy(getlabels(AST(0))));
  1884.     }
  1885.     insert_2child(node, AST(0), AST(1));
  1886.  
  1887.      break;
  1888.  /* delay_alternative ::= delay_statement [sequence_of_statements] */
  1889.  case 219 :
  1890.     node = node_new(as_delay_alt);
  1891.     if (AST(1) != OPT_NODE)
  1892.         newlabels(node, tup_copy(getlabels(AST(1))));
  1893.     insert_2child(node, AST(0), AST(1));
  1894.  
  1895.      break;
  1896.  /* terminate_alternative ::= TERMINATE ; {pragma} */
  1897.  case 220 :
  1898.     node = AST(2);
  1899.     check_pragmas(node, null_pragmas);
  1900.     erase_labels(node);
  1901.     N_KIND(node) = as_terminate_alt;
  1902.  
  1903.      break;
  1904.  /* conditional_entry_call ::= SELECT {pragma} call_statement [sequence_of_st */
  1905.  case 221 :
  1906.     node = node_new(as_conditional_entry_call);
  1907.     check_pragmas(AST(1), null_pragmas);
  1908.     pragmalist_warning(AST(1));
  1909.     newlabels(node,  tup_add(((AST(3) == OPT_NODE) ? tup_new(0) : 
  1910.         getlabels(AST(3))), getlabels(AST(5))));
  1911.     insert_3child(node, AST(2), AST(3), AST(5));
  1912.     free_everything(AST(1));
  1913.  
  1914.      break;
  1915.  /* timed_entry_call ::= SELECT {pragma} call_statement [sequence_of_statemen */
  1916.  case 222 :
  1917.     node = node_new(as_timed_entry_call);
  1918.     check_pragmas(AST(1), null_pragmas);
  1919.     check_pragmas(AST(5), null_pragmas);
  1920.     pragmalist_warning(AST(1));
  1921.     pragmalist_warning(AST(5));
  1922.     newlabels(node, tup_add(((AST(3) == OPT_NODE) ? tup_new(0) :
  1923.         getlabels(AST(3))), getlabels(AST(6))));
  1924.     free_everything(AST(1));
  1925.     free_everything(AST(5));
  1926.     insert_3child(node, AST(2), AST(3), AST(6));
  1927.  
  1928.      break;
  1929.  /* abort_statement ::= ABORT task_name {,task_name} ; */
  1930.  case 223 :
  1931.     node = AST(2);
  1932.     prepend(AST(1), node);
  1933.     N_KIND(node) = as_abort;
  1934.  
  1935.  /* compilation ::= {compilation_unit} */
  1936.  /* case 224 : */
  1937.  
  1938.      break;
  1939.  /* compilation_unit ::= context_clause library_unit */
  1940.  case 225 :
  1941.     node = node_new(as_unit);
  1942.     insert_2child(node, AST(0), AST(1));
  1943.  
  1944.      break;
  1945.  /* compilation_unit ::= context_clause secondary_unit */
  1946.  case 226 :
  1947.     node = node_new(as_unit);
  1948.     insert_2child(node, AST(0), AST(1));
  1949.  
  1950.  /* library_unit ::= subprogram_declaration */
  1951.  /* case 227 : */
  1952.  
  1953.  /* library_unit ::= package_declaration */
  1954.  /* case 228 : */
  1955.  
  1956.  /* library_unit ::= generic_declaration */
  1957.  /* case 229 : */
  1958.  
  1959.  /* library_unit ::= generic_instantiation */
  1960.  /* case 230 : */
  1961.  
  1962.  /* library_unit ::= subprogram_body */
  1963.  /* case 231 : */
  1964.  
  1965.  /* secondary_unit ::= library_unit_body */
  1966.  /* case 232 : */
  1967.  
  1968.  /* secondary_unit ::= subunit */
  1969.  /* case 233 : */
  1970.  
  1971.  /* library_unit_body ::= package_body */
  1972.  /* case 234 : */
  1973.  
  1974.  /* context_clause ::= {with_clause{use_clause}} */
  1975.  /* case 235 : */
  1976.  
  1977.      break;
  1978.  /* with_clause ::= WITH unit_simple_name {,unit_simple_name} ; */
  1979.  case 236 :
  1980.     node = AST(2);
  1981.     prepend(AST(1), node);
  1982.     N_KIND(node) = as_with;
  1983.  
  1984.      break;
  1985.  /* body_stub ::= subprogram_specification IS SEPARATE ; */
  1986.  case 237 :
  1987.     node = node_new(as_subprogram_stub);
  1988.     insert_1child(node, AST(0));
  1989.  
  1990.      break;
  1991.  /* body_stub ::= PACKAGE BODY package_simple_name IS SEPARATE ; */
  1992.  case 238 :
  1993.     node = AST(2);
  1994.     N_KIND(node) = as_package_stub;
  1995.  
  1996.      break;
  1997.  /* body_stub ::= TASK BODY task_simple_name IS SEPARATE ; */
  1998.  case 239 :
  1999.     node = AST(2);
  2000.     N_KIND(node) = as_task_stub;
  2001.  
  2002.      break;
  2003.  /* subunit ::= SEPARATE ( parent_unit_name ) proper_body */
  2004.  case 240 :
  2005.     node = node_new(as_separate);
  2006.     insert_2child(node, AST(2), AST(4));
  2007.  
  2008.      break;
  2009.  /* exception_declaration ::= identifier_list : EXCEPTION ; */
  2010.  case 241 :
  2011.     node = AST(0);
  2012.     N_KIND(node) = as_except_decl;
  2013.  
  2014.      break;
  2015.  /* exception_handler ::= WHEN exception_choice {|exception_choice} => sequen */
  2016.  case 242 :
  2017.     node = node_new(as_handler);
  2018.     prepend(AST(1), AST(2));
  2019.     newlabels(node, tup_copy(getlabels(AST(4))));
  2020.     insert_2child(node, AST(2), AST(4));
  2021.  
  2022.  /* exception_choice ::= exception_name */
  2023.  /* case 243 : */
  2024.  
  2025.      break;
  2026.  /* exception_choice ::= OTHERS */
  2027.  case 244 :
  2028.     node = node_new(as_others);
  2029.     set_span(node, LOC(0));
  2030.  
  2031.      break;
  2032.  /* raise_statement ::= RAISE [exception_name] ; */
  2033.  case 245 :
  2034. {
  2035.     Node span_node;
  2036.  
  2037.     node = node_new(as_raise);
  2038.     span_node = node_new(as_simple_name);
  2039.     N_ID(span_node) = IND(0);
  2040.     set_span(span_node, LOC(0));
  2041.     insert_2child(node, AST(1), span_node);
  2042. }
  2043.  
  2044.      break;
  2045.  /* generic_declaration ::= generic_specification ; */
  2046.  case 246 :
  2047.     node = AST(0);
  2048.  
  2049.      break;
  2050.  /* generic_specification ::= generic_formal_part subprogram_specification */
  2051.  case 247 :
  2052.     if (N_KIND(AST(1)) == as_function) {
  2053.         if (N_KIND(N_AST1(AST(1))) == as_operator)
  2054.             syntax_err(SPAN(N_AST1(AST(1))),
  2055.               "Operator symbol invalid in Generic specification");
  2056.         node = node_new(as_generic_function);
  2057.         insert_4child(node,  N_AST1(AST(1)), AST(0), N_AST2(AST(1)),
  2058.           N_AST3(AST(1)));
  2059.     }
  2060.     else {
  2061.         node = node_new(as_generic_procedure);
  2062.         insert_4child(node, N_AST1(AST(1)), AST(0), N_AST2(AST(1)), OPT_NODE);
  2063.     }
  2064. /*
  2065.     astfree(sub_spec->links.subast);
  2066. */
  2067.     nodefree(AST(1));
  2068.  
  2069.      break;
  2070.  /* generic_specification ::= generic_formal_part package_specification */
  2071.  case 248 :
  2072.     node = node_new(as_generic_package);
  2073.     insert_4child(node, N_AST1(AST(1)), AST(0), N_AST2(AST(1)), N_AST3(AST(1)));
  2074. /*
  2075.     astfree(pack_spec->links.subast);
  2076. */
  2077.     nodefree(AST(1));
  2078.  
  2079.      break;
  2080.  /* generic_formal_part ::= GENERIC {generic_parameter_declaration} */
  2081.  case 249 :
  2082.     node = AST(1);
  2083.     N_KIND(node) = as_generic_formals;
  2084.  
  2085.      break;
  2086.  /* generic_parameter_declaration ::= identifier_list : [IN[OUT]] type_mark [ */
  2087.  case 250 :
  2088.     node = node_new(as_generic_obj);
  2089.     insert_4child(node, AST(0), AST(2), AST(3), AST(4));
  2090.  
  2091.      break;
  2092.  /* generic_parameter_declaration ::= TYPE identifier IS generic_type_definit */
  2093.  case 251 :
  2094.     id_node = make_id(1);
  2095.     node = node_new(as_generic_type);
  2096.     insert_3child(node, id_node, OPT_NODE, AST(3));
  2097.  
  2098.      break;
  2099.  /* generic_parameter_declaration ::= private_type_declaration */
  2100.  case 252 :
  2101.     node = AST(0);
  2102.     N_KIND(node) = as_gen_priv_type;
  2103.  
  2104.      break;
  2105.  /* generic_parameter_declaration ::= WITH subprogram_specification [IS__name */
  2106.  case 253 :
  2107.     node = node_new(as_generic_subp);
  2108.     insert_2child(node, AST(1), AST(2));
  2109.  
  2110.      break;
  2111.  /* generic_type_definition ::= ( <> ) */
  2112.  case 254 :
  2113.     node = node_new(as_generic);
  2114.     N_ID(node) = namemap("discrete_type", 13);
  2115.     set_span(node, LOC(0));
  2116.  
  2117.      break;
  2118.  /* generic_type_definition ::= RANGE <> */
  2119.  case 255 :
  2120.     node = node_new(as_generic);
  2121.     N_ID(node) = namemap("INTEGER", 7);
  2122.     set_span(node, LOC(0));
  2123.  
  2124.      break;
  2125.  /* generic_type_definition ::= DIGITS <> */
  2126.  case 256 :
  2127.     node = node_new(as_generic);
  2128.     N_ID(node) = namemap("FLOAT", 5);
  2129.     set_span(node, LOC(0));
  2130.  
  2131.      break;
  2132.  /* generic_type_definition ::= DELTA <> */
  2133.  case 257 :
  2134.     node = node_new(as_generic);
  2135.     N_ID(node) = namemap("$FIXED", 6);
  2136.     set_span(node, LOC(0));
  2137.  
  2138.  /* generic_type_definition ::= array_type_definition */
  2139.  /* case 258 : */
  2140.  
  2141.  /* generic_type_definition ::= access_type_definition */
  2142.  /* case 259 : */
  2143.  
  2144.      break;
  2145.  /* generic_instantiation ::= PACKAGE identifier IS NEW generic_package_name  */
  2146.  case 260 :
  2147.     id_node = make_id(1);
  2148.     node = node_new(as_package_instance);
  2149.     insert_3child(node, id_node, AST(4), AST(5));
  2150.  
  2151.      break;
  2152.  /* generic_instantiation ::= FUNCTION designator IS NEW generic_function_nam */
  2153.  case 261 :
  2154.     node = node_new(as_function_instance);
  2155.     insert_3child(node, AST(1), AST(4), AST(5));
  2156.  
  2157.      break;
  2158.  /* generic_instantiation ::= subprogram_specification IS NEW generic_procedu */
  2159.  case 262 :
  2160.     if (N_KIND(AST(0)) != as_procedure)
  2161.         syntax_err(SPAN(AST(0)), "Bad generic procedure instantiation");
  2162.     if (N_AST2(AST(0)) != OPT_NODE)
  2163.         syntax_err(SPAN(AST(0)),
  2164.             "formal_part not allowed in procedure instantiation");
  2165.     node = node_new(as_procedure_instance);
  2166.     insert_3child(node, N_AST1(AST(0)), AST(3), AST(4));
  2167. /*
  2168.     FREEAST(sub_spec, 1);
  2169.     astfree(sub_spec->links.subast);
  2170. */
  2171.     nodefree(AST(0));
  2172.  
  2173.      break;
  2174.  /* generic_actual_part ::= ( generic_association {,generic_association} ) */
  2175.  case 263 :
  2176.     node = AST(2);
  2177.     prepend(AST(1), node);
  2178.  
  2179.  /* generic_association ::= [generic_formal_parameter=>]generic_actual_parame */
  2180.  /* case 264 : */
  2181.  
  2182.  /* generic_formal_parameter ::= parameter_simple_name */
  2183.  /* case 265 : */
  2184.  
  2185.      break;
  2186.  /* generic_formal_parameter ::= operator_symbol */
  2187.  case 266 :
  2188. {
  2189.     char tmp[MAXLINE + 1];
  2190.  
  2191.     node = AST(0);
  2192.     strcpy(tmp, namelist(N_ID(node)));
  2193.     convtolower(tmp);
  2194.     if (!isoverloadable_op(tmp)) {
  2195.         char msg[MAXLINE + 30];
  2196.  
  2197.         sprintf(msg, "\"%s\" is not a valid operator_symbol", tmp);
  2198.         syntax_err(get_left_span_p(node), get_right_span_p(node), msg);
  2199.     }
  2200.     N_ID(node) = namemap(tmp, strlen(tmp));
  2201. }
  2202.  
  2203.  /* generic_actual_parameter ::= expression */
  2204.  /* case 267 : */
  2205.  
  2206.      break;
  2207.  /* representation_clause ::= type_representation_clause */
  2208.  case 268 :
  2209.     node = AST(0);
  2210.  
  2211.      break;
  2212.  /* representation_clause ::= address_clause */
  2213.  case 269 :
  2214.     node = AST(0);
  2215.     syntax_err(SPAN(node), "address_clause not supported");
  2216.  
  2217.  /* type_representation_clause ::= length_clause */
  2218.  /* case 270 : */
  2219.  
  2220.  /* type_representation_clause ::= enumeration_representation_clause */
  2221.  /* case 271 : */
  2222.  
  2223.  /* type_representation_clause ::= record_representation_clause */
  2224.  /* case 272 : */
  2225.  
  2226.      break;
  2227.  /* length_clause ::= FOR attribute USE simple_expression ; */
  2228.  case 273 :
  2229.     node = node_new(as_length_clause);
  2230.     insert_2child(node, AST(1), AST(3));
  2231.  
  2232.      break;
  2233.  /* enumeration_representation_clause ::= FOR type_simple_name USE aggregate  */
  2234.  case 274 :
  2235.     node = node_new(as_enum_rep_clause);
  2236.     insert_2child(node, AST(1), AST(3));
  2237.  
  2238.      break;
  2239.  /* record_representation_clause ::= FOR type_simple_name USE RECORD [alignme */
  2240.  case 275 :
  2241.     node = node_new(as_rec_rep_clause);
  2242.     insert_3child(node, AST(1), AST(4), AST(5));
  2243.  
  2244.      break;
  2245.  /* alignment_clause ::= AT MOD static_simple_expression ; */
  2246.  case 276 :
  2247.     node = AST(2);    
  2248.  
  2249.      break;
  2250.  /* component_clause ::= component_name AT static_simple_expression RANGE sta */
  2251.  case 277 :
  2252.     node = node_new(as_compon_clause);
  2253.     if (N_KIND(AST(4)) != as_range && N_KIND(AST(4))!= as_range_attribute)
  2254.         syntax_err(SPAN(AST(4)), "Invalid range specification");
  2255.     insert_3child(node, AST(0), AST(2), AST(4));
  2256.  
  2257.      break;
  2258.  /* address_clause ::= FOR simple_name USE AT simple_expression ; */
  2259.  case 278 :
  2260.     node = node_new(as_address_clause);
  2261.     insert_2child(node, AST(1), AST(4));
  2262.  
  2263.      break;
  2264.  /* code_statement ::= name ' record_aggregate ; */
  2265.  case 279 :
  2266.     if (!check_expanded_name(AST(0)))
  2267.         syntax_err(SPAN(AST(0)), "Invalid type_mark in code statement");
  2268.     node = node_new(as_code);
  2269.     insert_2child(node, AST(0), AST(2));
  2270.  
  2271.  
  2272.      break;
  2273.  /* {PRAGMA} ::= empty */
  2274.  case 280 :
  2275.  node = node_new(as_list);
  2276.  N_LIST(node) = tup_new(0);
  2277.  set_span(node, &curtok->ptr.token->span);
  2278.  
  2279.      break;
  2280.  /* {PRAGMA} ::= {pragma} pragma */
  2281.  case 281 :
  2282.     node = AST(0);
  2283.     if (AST(1) != any_node)
  2284.         append(node, AST(1));
  2285.  
  2286.  
  2287.      break;
  2288.  /* [(argument_association{,argument_association})] ::= empty */
  2289.  case 282 :
  2290.  node = OPT_NODE;
  2291.  
  2292.      break;
  2293.  /* [(argument_association{,argument_association})] ::= ( argument_associatio */
  2294.  case 283 :
  2295.     node = AST(1);
  2296.  
  2297.      break;
  2298.  /* argument_association_list ::= argument_association */
  2299.  case 284 :
  2300.     node = node_new(as_arg_assoc_list);
  2301.     N_LIST(node) = tup_new1((char *)AST(0));
  2302.  
  2303.      break;
  2304.  /* argument_association_list ::= argument_association_list , argument_associ */
  2305.  case 285 :
  2306.     node = AST(0);
  2307.     append(node, AST(2));
  2308.  
  2309.      break;
  2310.  /* [argument_identifier=>]expression ::= expression */
  2311.  case 286 :
  2312.     node = node_new(as_arg);
  2313.     insert_2child(node, OPT_NODE, AST(0));
  2314.  
  2315.      break;
  2316.  /* [argument_identifier=>]expression ::= argument_identifier => expression */
  2317.  case 287 :
  2318.  
  2319.     id_node = make_id(0);
  2320.     node = node_new(as_arg);
  2321.     insert_2child(node, id_node, AST(2));
  2322.  
  2323.  
  2324.      break;
  2325.  /* [:=expression] ::= empty */
  2326.  case 288 :
  2327.  node = OPT_NODE;
  2328.  
  2329.      break;
  2330.  /* [:=expression] ::= := expression */
  2331.  case 289 :
  2332.     node = AST(1);
  2333.  
  2334.  
  2335.      break;
  2336.  /* [CONSTANT] ::= empty */
  2337.  case 290 :
  2338.  node = OPT_NODE;
  2339.  
  2340.      break;
  2341.  /* [CONSTANT] ::= CONSTANT */
  2342.  case 291 :
  2343.     node = any_node;
  2344.  
  2345.  
  2346.      break;
  2347.  /* {,identifier} ::= empty */
  2348.  case 292 :
  2349.  node = node_new(as_list);
  2350.  N_LIST(node) = tup_new(0);
  2351.  set_span(node, &curtok->ptr.token->span);
  2352.  
  2353.      break;
  2354.  /* {,identifier} ::= {,identifier} , identifier */
  2355.  case 293 :
  2356.     node = AST(0);
  2357.     id_node = make_id(2);
  2358.     append(node, id_node);
  2359.  
  2360.  
  2361.      break;
  2362.  /* [discriminant_part]IS ::= IS */
  2363.  case 294 :
  2364.  node = OPT_NODE;
  2365.  
  2366.      break;
  2367.  /* [discriminant_part]IS ::= discriminant_part IS */
  2368.  case 295 :
  2369.     node = AST(0);
  2370.  
  2371.  
  2372.      break;
  2373.  /* [constraint] ::= empty */
  2374.  case 296 :
  2375.  node = OPT_NODE;
  2376.  
  2377.  /* [constraint] ::= constraint */
  2378.  /* case 297 : */
  2379.  
  2380.      break;
  2381.  /* expanded_name ::= identifier */
  2382.  case 298 :
  2383.     node = node_new(as_simple_name);
  2384.     N_ID(node) = IND(0);
  2385.     set_span(node, LOC(0));
  2386.  
  2387.      break;
  2388.  /* expanded_name ::= expanded_name . identifier */
  2389.  case 299 :
  2390.     id_node = make_id(2);
  2391.     node = node_new(as_selector);
  2392.     insert_2child(node, AST(0), id_node);
  2393.  
  2394.  
  2395.      break;
  2396.  /* {,enumeration_literal_specification} ::= empty */
  2397.  case 300 :
  2398.  node = node_new(as_list);
  2399.  N_LIST(node) = tup_new(0);
  2400.  set_span(node, &curtok->ptr.token->span);
  2401.  
  2402.      break;
  2403.  /* {,enumeration_literal_specification} ::= {,enumeration_literal_specificat */
  2404.  case 301 :
  2405.     node = AST(0);
  2406.     append(node, AST(2));
  2407.  
  2408.  
  2409.      break;
  2410.  /* [range_constraint] ::= empty */
  2411.  case 302 :
  2412.  node = OPT_NODE;
  2413.  
  2414.  /* [range_constraint] ::= range_constraint */
  2415.  /* case 303 : */
  2416.  
  2417.  
  2418.      break;
  2419.  /* {,index_subtype_definition} ::= empty */
  2420.  case 304 :
  2421.  node = node_new(as_list);
  2422.  N_LIST(node) = tup_new(0);
  2423.  set_span(node, &curtok->ptr.token->span);
  2424.  
  2425.      break;
  2426.  /* {,index_subtype_definition} ::= {,index_subtype_definition} , index_subty */
  2427.  case 305 :
  2428.     node = AST(0);
  2429.     append(node, AST(2));
  2430.  
  2431.  
  2432.      break;
  2433.  /* {,discrete_range} ::= empty */
  2434.  case 306 :
  2435.  node = node_new(as_list);
  2436.  N_LIST(node) = tup_new(0);
  2437.  set_span(node, &curtok->ptr.token->span);
  2438.  
  2439.      break;
  2440.  /* {,discrete_range} ::= {,discrete_range} , discrete_range */
  2441.  case 307 :
  2442.     node = AST(0);
  2443.     append(node, AST(2));
  2444.  
  2445.  
  2446.      break;
  2447.  /* {component_declaration} ::= empty */
  2448.  case 308 :
  2449.  node = node_new(as_list);
  2450.  N_LIST(node) = tup_new(0);
  2451.  set_span(node, &curtok->ptr.token->span);
  2452.  
  2453.      break;
  2454.  /* {component_declaration} ::= {component_declaration} component_declaration */
  2455.  case 309 :
  2456.     node = AST(0);
  2457.     check_pragmas(AST(2), null_pragmas);
  2458.     N_LIST(node) = tup_add(tup_with(N_LIST(node), (char *)AST(1)),
  2459.       N_LIST(AST(2)));
  2460.     nodefree(AST(2));
  2461.  
  2462.  
  2463.      break;
  2464.  /* {;discriminant_specification} ::= empty */
  2465.  case 310 :
  2466.  node = node_new(as_list);
  2467.  N_LIST(node) = tup_new(0);
  2468.  set_span(node, &curtok->ptr.token->span);
  2469.  
  2470.      break;
  2471.  /* {;discriminant_specification} ::= {;discriminant_specification} ; discrim */
  2472.  case 311 :
  2473.     node = AST(0);
  2474.     append(node, AST(2));
  2475.  
  2476.  
  2477.      break;
  2478.  /* {variant} ::= empty */
  2479.  case 312 :
  2480.  node = node_new(as_list);
  2481.  N_LIST(node) = tup_new(0);
  2482.  set_span(node, &curtok->ptr.token->span);
  2483.  
  2484.      break;
  2485.  /* {variant} ::= {variant} variant */
  2486.  case 313 :
  2487.     node = AST(0);
  2488.     append(node, AST(1));
  2489.  
  2490.  
  2491.      break;
  2492.  /* {|choice} ::= empty */
  2493.  case 314 :
  2494.  node = node_new(as_list);
  2495.  N_LIST(node) = tup_new(0);
  2496.  set_span(node, &curtok->ptr.token->span);
  2497.  
  2498.      break;
  2499.  /* {|choice} ::= {|choice} '|' choice */
  2500.  case 315 :
  2501.     node = AST(0);
  2502.     append(node, AST(2));
  2503.  
  2504.  
  2505.      break;
  2506.  /* [discriminant_part]; ::= ; */
  2507.  case 316 :
  2508.  node = OPT_NODE;
  2509.  
  2510.      break;
  2511.  /* [discriminant_part]; ::= discriminant_part ; */
  2512.  case 317 :
  2513.     node  = AST(0);
  2514.  
  2515.      break;
  2516.  /* {basic_declarative_item} ::= {pragma} */
  2517.  case 318 :
  2518.     check_pragmas(AST(0), immediate_decl_pragmas);
  2519.     node = AST(0);
  2520.  
  2521.      break;
  2522.  /* {basic_declarative_item} ::= {basic_declarative_item} basic_declarative_i */
  2523.  case 319 :
  2524.     node = AST(0);
  2525.     check_pragmas(AST(2), immediate_decl_pragmas);
  2526.     N_LIST(node) = tup_add(tup_with(N_LIST(node), (char *)AST(1)),
  2527.       N_LIST(AST(2)));
  2528.     nodefree(AST(2));
  2529.  
  2530.  
  2531.      break;
  2532.  /* {,component_association} ::= empty */
  2533.  case 320 :
  2534.  node = node_new(as_list);
  2535.  N_LIST(node) = tup_new(0);
  2536.  set_span(node, &curtok->ptr.token->span);
  2537.  
  2538.      break;
  2539.  /* {,component_association} ::= {,component_association} , component_associa */
  2540.  case 321 :
  2541.     node = AST(0);
  2542.     append(node, AST(2));
  2543.  
  2544.  /* [choice{|choice}=>]expression ::= expression */
  2545.  /* case 322 : */
  2546.  
  2547.      break;
  2548.  /* [choice{|choice}=>]expression ::= choice {|choice} => expression */
  2549.  case 323 :
  2550.     prepend(AST(0), AST(1));
  2551.     node = node_new(as_choice_list);
  2552.     insert_2child(node, AST(1), AST(3));
  2553.  
  2554.  
  2555.      break;
  2556.  /* {,general_component_association} ::= empty */
  2557.  case 324 :
  2558.  node = node_new(as_list);
  2559.  N_LIST(node) = tup_new(0);
  2560.  set_span(node, &curtok->ptr.token->span);
  2561.  
  2562.      break;
  2563.  /* {,general_component_association} ::= {,general_component_association} , g */
  2564.  case 325 :
  2565.     node = AST(0);
  2566.     append(node, AST(2));
  2567.  
  2568.      break;
  2569.  /* relation{AND__relation} ::= relation AND relation */
  2570.  case 326 :
  2571.  
  2572.  /* relation{AND__relation} ::= relation{AND__relation} AND relation */
  2573.  case 327 :
  2574.  
  2575.  /* relation{OR__relation} ::= relation OR relation */
  2576.  case 328 :
  2577.  
  2578.  /* relation{OR__relation} ::= relation{OR__relation} OR relation */
  2579.  case 329 :
  2580.  
  2581.  /* relation{XOR__relation} ::= relation XOR relation */
  2582.  case 330 :
  2583.  
  2584.  /* relation{XOR__relation} ::= relation{XOR__relation} XOR relation */
  2585.  case 331 :
  2586.     id_node = make_id(1);
  2587.     node = binary_operator(id_node, AST(0), AST(2));
  2588.  
  2589.      break;
  2590.  /* relation{AND__THEN__relation} ::= relation AND THEN relation */
  2591.  case 332 :
  2592.  
  2593.  /* relation{AND__THEN__relation} ::= relation{AND__THEN__relation} AND THEN  */
  2594.  case 333 :
  2595. {
  2596.     Node optr_node;
  2597.  
  2598.     optr_node = node_new(as_simple_name);
  2599.     N_ID(optr_node) = namemap("andthen", 7);
  2600.     set_span(optr_node, LOC(1));
  2601.     node = binary_operator(optr_node, AST(0), AST(3));
  2602. }
  2603.  
  2604.      break;
  2605.  /* relation{OR__ELSE__relation} ::= relation OR ELSE relation */
  2606.  case 334 :
  2607.  
  2608.  /* relation{OR__ELSE__relation} ::= relation{OR__ELSE__relation} OR ELSE rel */
  2609.  case 335 :
  2610. {
  2611.     Node optr_node;
  2612.  
  2613.     optr_node = node_new(as_simple_name);
  2614.     N_ID(optr_node) = namemap("orelse", 6);
  2615.     set_span(optr_node, LOC(1));
  2616.     node = binary_operator(optr_node, AST(0), AST(3));
  2617. }
  2618.  
  2619.  
  2620.      break;
  2621.  /* [relational_operator__simple_expression] ::= empty */
  2622.  case 336 :
  2623.  node = OPT_NODE;
  2624.  
  2625.      break;
  2626.  /* [relational_operator__simple_expression] ::= relational_operator simple_e */
  2627.  case 337 :
  2628.     node = binary_operator(AST(0), any_node, AST(1));
  2629.  
  2630.  
  2631.      break;
  2632.  /* [NOT] ::= empty */
  2633.  case 338 :
  2634.  node = OPT_NODE;
  2635.  
  2636.      break;
  2637.  /* [NOT] ::= NOT */
  2638.  case 339 :
  2639.     node = any_node;
  2640.  
  2641.  /* [unary_adding_operator]term{binary_adding_operator__term} ::= term */
  2642.  /* case 340 : */
  2643.  
  2644.      break;
  2645.  /* [unary_adding_operator]term{binary_adding_operator__term} ::= unary_addin */
  2646.  case 341 :
  2647.     node = unary_operator(AST(0), AST(1));
  2648.  
  2649.      break;
  2650.  /* [unary_adding_operator]term{binary_adding_operator__term} ::= [unary_addi */
  2651.  case 342 :
  2652.     node = binary_operator(AST(1), AST(0), AST(2));
  2653.  
  2654.  /* factor{multiplying_operator__factor} ::= factor */
  2655.  /* case 343 : */
  2656.  
  2657.      break;
  2658.  /* factor{multiplying_operator__factor} ::= factor{multiplying_operator__fac */
  2659.  case 344 :
  2660.     node = binary_operator(AST(1), AST(0), AST(2));
  2661.  
  2662.  
  2663.      break;
  2664.  /* [**__primary] ::= empty */
  2665.  case 345 :
  2666.  node = OPT_NODE;
  2667.  
  2668.      break;
  2669.  /* [**__primary] ::= ** primary */
  2670.  case 346 :
  2671.     id_node = make_id(0);
  2672.     node = binary_operator(id_node, any_node, AST(1));
  2673.  
  2674.      break;
  2675.  /* {statement} ::= {pragma} */
  2676.  case 347 :
  2677.     check_pragmas(AST(0), null_pragmas);
  2678.     node = AST(0);
  2679.  
  2680.      break;
  2681.  /* {statement} ::= {statement} statement {pragma} */
  2682.  case 348 :
  2683.     node = AST(0);
  2684.     check_pragmas(AST(2), null_pragmas);
  2685.     N_LIST(node) = tup_add(tup_with(N_LIST(node), (char *)AST(1)),
  2686.       N_LIST(AST(2)));
  2687.     nodefree(AST(2));
  2688.  
  2689.  
  2690.      break;
  2691.  /* {label} ::= empty */
  2692.  case 349 :
  2693.  node = node_new(as_list);
  2694.  N_LIST(node) = tup_new(0);
  2695.  set_span(node, &curtok->ptr.token->span);
  2696.  
  2697.      break;
  2698.  /* {label} ::= {label} label */
  2699.  case 350 :
  2700.     node = AST(0);
  2701.     append(node, AST(1));
  2702.  
  2703.  
  2704.      break;
  2705.  /* {ELSIF__condition__THEN__sequence_of_statements} ::= empty */
  2706.  case 351 :
  2707.  node = node_new(as_list);
  2708.  N_LIST(node) = tup_new(0);
  2709.  set_span(node, &curtok->ptr.token->span);
  2710.  
  2711.      break;
  2712.  /* {ELSIF__condition__THEN__sequence_of_statements} ::= {ELSIF__condition__T */
  2713.  case 352 :
  2714. {
  2715.     Node if_node;
  2716.     
  2717.     node = AST(0);
  2718.     if_node = node_new(as_cond_statements);
  2719.     insert_2child(if_node, AST(2), AST(4));
  2720.     append(node, if_node);
  2721. }
  2722.  
  2723.  
  2724.      break;
  2725.  /* [ELSE__sequence_of_statements] ::= empty */
  2726.  case 353 :
  2727.  node = OPT_NODE;
  2728.  
  2729.      break;
  2730.  /* [ELSE__sequence_of_statements] ::= ELSE sequence_of_statements */
  2731.  case 354 :
  2732.     node = AST(1);
  2733.  
  2734.  
  2735.      break;
  2736.  /* {case_statement_alternative} ::= empty */
  2737.  case 355 :
  2738.  node = node_new(as_list);
  2739.  N_LIST(node) = tup_new(0);
  2740.  set_span(node, &curtok->ptr.token->span);
  2741.  
  2742.      break;
  2743.  /* {case_statement_alternative} ::= {case_statement_alternative} case_statem */
  2744.  case 356 :
  2745.     node = AST(0);
  2746.     append(node, AST(1));
  2747.  
  2748.  
  2749.      break;
  2750.  /* [simple_name:] ::= empty */
  2751.  case 357 :
  2752.  node = OPT_NODE;
  2753.  
  2754.      break;
  2755.  /* [simple_name:] ::= simple_name : */
  2756.  case 358 :
  2757.     node = AST(0);
  2758.  
  2759.  
  2760.      break;
  2761.  /* [simple_name] ::= empty */
  2762.  case 359 :
  2763.  node = OPT_NODE;
  2764.  
  2765.  /* [simple_name] ::= simple_name */
  2766.  /* case 360 : */
  2767.  
  2768.  
  2769.      break;
  2770.  /* [iteration_scheme] ::= empty */
  2771.  case 361 :
  2772.  node = OPT_NODE;
  2773.  
  2774.  /* [iteration_scheme] ::= iteration_scheme */
  2775.  /* case 362 : */
  2776.  
  2777.  
  2778.      break;
  2779.  /* [REVERSE] ::= empty */
  2780.  case 363 :
  2781.  node = OPT_NODE;
  2782.  
  2783.      break;
  2784.  /* [REVERSE] ::= REVERSE */
  2785.  case 364 :
  2786.     node = any_node;
  2787.  
  2788.      break;
  2789.  /* [DECLARE__declarative_part] ::= empty */
  2790.  case 365 :
  2791.     node = node_new(as_declarations);
  2792.     N_LIST(node) = tup_new(0);
  2793.  
  2794.      break;
  2795.  /* [DECLARE__declarative_part] ::= DECLARE declarative_part */
  2796.  case 366 :
  2797.     node = AST(1);
  2798.  
  2799.  
  2800.      break;
  2801.  /* [EXCEPTION__exception_handler{exception_handler}] ::= empty */
  2802.  case 367 :
  2803.  node = OPT_NODE;
  2804.  
  2805.      break;
  2806.  /* [EXCEPTION__exception_handler{exception_handler}] ::= EXCEPTION {pragma}  */
  2807.  case 368 :
  2808. {
  2809.     Tuple nodelabels = tup_new(0);
  2810.  
  2811.     node = AST(2);
  2812.     check_pragmas(AST(1), null_pragmas);
  2813.     FORTUP(tmp_node = (Node), N_LIST(node), ft1);
  2814.         nodelabels = tup_add(nodelabels, getlabels(tmp_node));
  2815.     ENDFORTUP(ft1);
  2816.     newlabels(node, nodelabels);
  2817.     N_KIND(node) = as_exception;
  2818.     N_LIST(node) = tup_add(N_LIST(AST(1)), N_LIST(node));
  2819.     check_choices(node, "an exception_handler list");
  2820.     nodefree(AST(1));
  2821. }
  2822.  
  2823.      break;
  2824.  /* exception_handler_list ::= exception_handler */
  2825.  case 369 :
  2826.     node = node_new(as_list);
  2827.     N_LIST(node) = tup_new1((char *)AST(0));
  2828.  
  2829.      break;
  2830.  /* exception_handler_list ::= exception_handler_list exception_handler */
  2831.  case 370 :
  2832.     node = AST(0);
  2833.     append(node, AST(1));
  2834.  
  2835.  
  2836.      break;
  2837.  /* [expanded_name] ::= empty */
  2838.  case 371 :
  2839.  node = OPT_NODE;
  2840.  
  2841.  /* [expanded_name] ::= expanded_name */
  2842.  /* case 372 : */
  2843.  
  2844.  
  2845.      break;
  2846.  /* [WHEN__condition] ::= empty */
  2847.  case 373 :
  2848.  node = OPT_NODE;
  2849.  
  2850.      break;
  2851.  /* [WHEN__condition] ::= WHEN condition */
  2852.  case 374 :
  2853.     node = AST(1);
  2854.  
  2855.  
  2856.      break;
  2857.  /* [expression] ::= empty */
  2858.  case 375 :
  2859.  node = OPT_NODE;
  2860.  
  2861.  /* [expression] ::= expression */
  2862.  /* case 376 : */
  2863.  
  2864.  
  2865.      break;
  2866.  /* [formal_part] ::= empty */
  2867.  case 377 :
  2868.  node = OPT_NODE;
  2869.  
  2870.  /* [formal_part] ::= formal_part */
  2871.  /* case 378 : */
  2872.  
  2873.  
  2874.      break;
  2875.  /* {;parameter_specification} ::= empty */
  2876.  case 379 :
  2877.  node = node_new(as_list);
  2878.  N_LIST(node) = tup_new(0);
  2879.  set_span(node, &curtok->ptr.token->span);
  2880.  
  2881.      break;
  2882.  /* {;parameter_specification} ::= {;parameter_specification} ; parameter_spe */
  2883.  case 380 :
  2884.     node = AST(0);
  2885.     append(node, AST(2));
  2886.  
  2887.      break;
  2888.  /* [IN] ::= empty */
  2889.  case 381 :
  2890.     node = node_new(as_mode);
  2891.     N_ID(node) = namemap("", 0);
  2892.     set_span(node, &curtok->ptr.token->span);
  2893.  
  2894.      break;
  2895.  /* [IN] ::= IN */
  2896.  case 382 :
  2897.     node = node_new(as_mode);
  2898.     N_ID(node) = namemap("in", 2);
  2899.     set_span(node, LOC(0));
  2900.  
  2901.  
  2902.      break;
  2903.  /* [designator] ::= empty */
  2904.  case 383 :
  2905.  node = OPT_NODE;
  2906.  
  2907.  /* [designator] ::= designator */
  2908.  /* case 384 : */
  2909.  
  2910.  
  2911.      break;
  2912.  /* [PRIVATE{basic_declarative_item}] ::= empty */
  2913.  case 385 :
  2914.  node = OPT_NODE;
  2915.  
  2916.      break;
  2917.  /* [PRIVATE{basic_declarative_item}] ::= PRIVATE {basic_declarative_item} */
  2918.  case 386 :
  2919.     node = AST(1);
  2920.     FORTUP(tmp_node = (Node), N_LIST(node), ft1);
  2921.         if (isbody_node[N_KIND(tmp_node)])
  2922.             syntax_err(SPAN(tmp_node),
  2923.      "Body declaration not allowed in private part of package_specification");
  2924.     ENDFORTUP(ft1);
  2925.     N_KIND(node) = as_declarations;
  2926.     ins_as_line_no(node);
  2927.  
  2928.  
  2929.      break;
  2930.  /* [LIMITED] ::= empty */
  2931.  case 387 :
  2932.  node = OPT_NODE;
  2933.  
  2934.      break;
  2935.  /* [LIMITED] ::= LIMITED */
  2936.  case 388 :
  2937.     node = any_node;
  2938.     set_span(node, LOC(0));
  2939.  
  2940.  
  2941.      break;
  2942.  /* {,package_name} ::= empty */
  2943.  case 389 :
  2944.  node = node_new(as_list);
  2945.  N_LIST(node) = tup_new(0);
  2946.  set_span(node, &curtok->ptr.token->span);
  2947.  
  2948.      break;
  2949.  /* {,package_name} ::= {,package_name} , package_name */
  2950.  case 390 :
  2951.     node = AST(0);
  2952.     append(node, AST(2));
  2953.  
  2954.      break;
  2955.  /* identifier:type_mark ::= identifier_list : type_mark */
  2956.  case 391 :
  2957. {
  2958.     id_node = (Node) N_LIST(AST(0))[1];
  2959.     if(tup_size(N_LIST(AST(0))) != 1) {
  2960.         syntax_err(get_left_span_p(AST(0)), get_right_span_p(AST(2)),
  2961.           "Only one identifier is allowed in this context");
  2962.         tup_fromb(N_LIST(AST(0)));
  2963.     }
  2964.     else
  2965.         N_LIST(AST(0)) = tup_new(0);
  2966. /* HMMMM????? - AST(0) free-ed andyway
  2967.     TFREE(tmp, tmp);
  2968. */
  2969.     free_everything(AST(0));
  2970.     node = node_new(as_rename_obj);
  2971.     insert_3child(node, id_node, AST(2), any_node);
  2972. }
  2973.  
  2974.      break;
  2975.  /* identifier:EXCEPTION ::= identifier_list : EXCEPTION */
  2976.  case 392 :
  2977. {
  2978.     id_node = (Node) N_LIST(AST(0))[1];
  2979.     if(tup_size(N_LIST(AST(0))) != 1) {
  2980.         syntax_err(get_left_span_p(AST(0)), END_LOC(2),
  2981.           "Only one identifier is allowed in this context");
  2982.         tup_fromb(N_LIST(AST(0)));
  2983.     }
  2984.     else
  2985.         N_LIST(AST(0)) = tup_new(0);
  2986. /* ???? see above
  2987.     TFREE(tmp, tmp);
  2988. */
  2989.     free_everything(AST(0));
  2990.     node = node_new(as_rename_ex);
  2991.     insert_2child(node, id_node, any_node);
  2992. }
  2993.  
  2994.  
  2995.      break;
  2996.  /* [TYPE] ::= empty */
  2997.  case 393 :
  2998.  node = OPT_NODE;
  2999.  
  3000.      break;
  3001.  /* [TYPE] ::= TYPE */
  3002.  case 394 :
  3003.     node = any_node;
  3004.  
  3005.      break;
  3006.  /* {entry_declaration} ::= {pragma} */
  3007.  case 395 :
  3008.     node = AST(0);
  3009.     check_pragmas(node, task_pragmas);
  3010.  
  3011.      break;
  3012.  /* {entry_declaration} ::= {entry_declaration} entry_declaration {pragma} */
  3013.  case 396 :
  3014.     node = AST(0);
  3015.     check_pragmas(AST(2), task_pragmas);
  3016.     N_LIST(node) = tup_add(tup_with(N_LIST(node), (char *)AST(1)),
  3017.       N_LIST(AST(2)));
  3018.     nodefree(AST(2));
  3019.  
  3020.  
  3021.      break;
  3022.  /* {representation_clause} ::= empty */
  3023.  case 397 :
  3024.  node = node_new(as_list);
  3025.  N_LIST(node) = tup_new(0);
  3026.  set_span(node, &curtok->ptr.token->span);
  3027.  
  3028.      break;
  3029.  /* {representation_clause} ::= {representation_clause} representation_clause */
  3030.  case 398 :
  3031.     node = AST(0);
  3032.     check_pragmas(AST(2), task_repr_pragmas);
  3033.     N_LIST(node) = tup_add(tup_with(N_LIST(node), (char *)AST(1)),
  3034.       N_LIST(AST(2)));
  3035.     nodefree(AST(2));
  3036.  
  3037.      break;
  3038.  /* [(discrete_range)][formal_part] ::= [formal_part] */
  3039.  case 399 :
  3040.     node = node_new(as_entry);
  3041.     insert_2child(node, any_node, AST(0));
  3042.     set_span(any_node, get_left_span_p(AST(0))); /* kludge for errors */
  3043.  
  3044.      break;
  3045.  /* [(discrete_range)][formal_part] ::= ( discrete_range ) [formal_part] */
  3046.  case 400 :
  3047.     check_discrete_range(AST(1));
  3048.     node = node_new(as_entry_family);
  3049.     insert_3child(node, any_node, AST(1), AST(3));
  3050.  
  3051.      break;
  3052.  /* [(entry_index)][formal_part] ::= [formal_part] */
  3053.  case 401 :
  3054.     node = node_new(as_accept);
  3055.     insert_4child(node, any_node, OPT_NODE, AST(0), any_node);
  3056.  
  3057.      break;
  3058.  /* [(entry_index)][formal_part] ::= ( entry_index ) [formal_part] */
  3059.  case 402 :
  3060.     node = node_new(as_accept);
  3061.     insert_4child(node, any_node, AST(1), AST(3), any_node);
  3062.  
  3063.  
  3064.      break;
  3065.  /* {OR__select_alternative} ::= empty */
  3066.  case 403 :
  3067.  node = node_new(as_list);
  3068.  N_LIST(node) = tup_new(0);
  3069.  set_span(node, &curtok->ptr.token->span);
  3070.  
  3071.      break;
  3072.  /* {OR__select_alternative} ::= {OR__select_alternative} OR {pragma} select_ */
  3073.  case 404 :
  3074.     node = AST(0);
  3075.     check_pragmas(AST(2), null_pragmas);
  3076.     N_LIST(node) = tup_with(tup_add(N_LIST(node), N_LIST(AST(2))),
  3077.      (char *) AST(3));
  3078.     nodefree(AST(2));
  3079.  
  3080.  
  3081.      break;
  3082.  /* [WHEN__condition=>] ::= empty */
  3083.  case 405 :
  3084.  node = OPT_NODE;
  3085.  
  3086.      break;
  3087.  /* [WHEN__condition=>] ::= WHEN condition => {pragma} */
  3088.  case 406 :
  3089.     node = AST(1);
  3090.     check_pragmas(AST(3), null_pragmas);
  3091.     pragmalist_warning(AST(3));
  3092.     free_everything(AST(3));
  3093.  
  3094.      break;
  3095.  /* [sequence_of_statements] ::= {pragma} */
  3096.  case 407 :
  3097.     check_pragmas(AST(0), null_pragmas);
  3098.     if (tup_size(N_LIST(AST(0)))) {
  3099.         Node label_list_node;
  3100.  
  3101.         node = node_new(as_statements);
  3102.         label_list_node = node_new(as_list);
  3103.         N_LIST(label_list_node) = tup_new(0);
  3104.         set_span(label_list_node, &curtok->ptr.token->span);
  3105.         insert_2child(node, AST(0), label_list_node);
  3106.     }
  3107.     else
  3108.         node = OPT_NODE;
  3109.      set_span(node, &curtok->ptr.token->span);
  3110.  
  3111.  /* [sequence_of_statements] ::= sequence_of_statements */
  3112.  /* case 408 : */
  3113.  
  3114.  
  3115.      break;
  3116.  /* {,task_name} ::= empty */
  3117.  case 409 :
  3118.  node = node_new(as_list);
  3119.  N_LIST(node) = tup_new(0);
  3120.  set_span(node, &curtok->ptr.token->span);
  3121.  
  3122.      break;
  3123.  /* {,task_name} ::= {,task_name} , task_name */
  3124.  case 410 :
  3125.     node = AST(0);
  3126.     append(node, AST(2));
  3127.  
  3128.      break;
  3129.  /* {compilation_unit} ::= {pragma} */
  3130.  case 411 :
  3131.     check_pragmas(AST(0), compilation_pragmas);
  3132. /* This seems to be never used
  3133.         if (astopt)
  3134.             print_tree(AST(0));
  3135. */
  3136.     if (curtok->symbol != EOFT_SYM) {
  3137.         free_everything(AST(0));
  3138.         free_labels();
  3139.     }
  3140.     prs_stack->symbol = lhs[red];
  3141.     return;
  3142.  
  3143.      break;
  3144.  /* {compilation_unit} ::= {compilation_unit} compilation_unit {pragma} */
  3145.  case 412 :
  3146. {
  3147.     extern int unit_number_now, unit_numbers, seq_node_n;
  3148.     extern char** seq_node;
  3149.     Node snode;
  3150.     int i;
  3151.  
  3152.     node = AST(0);
  3153.     check_pragmas(AST(2), after_libunit_pragmas);
  3154.     pragmalist_warning(AST(2));
  3155.     unit_number_now = unit_numbers + 1;
  3156. /*
  3157.     snode = cvt_tree(AST(1));
  3158.     adasem(seq_node[seq_node_n]);
  3159. */
  3160.     for (i = 1; i <= seq_node_n; i++) {
  3161.         Node tmp_node = (Node) seq_node[i];
  3162.         if (!tmp_node) continue;
  3163.         if (N_KIND(tmp_node) == as_line_no) continue;
  3164. /*
  3165.         if (N_AST1(tmp_node) == (Node)0) N_AST1(tmp_node) = OPT_NODE;
  3166.         if (N_AST2(tmp_node) == (Node)0) N_AST2(tmp_node) = OPT_NODE;
  3167.         if (N_AST3(tmp_node) == (Node)0) N_AST3(tmp_node) = OPT_NODE;
  3168.         if (N_AST4(tmp_node) == (Node)0) N_AST4(tmp_node) = OPT_NODE;
  3169. */
  3170.         if (N_KIND(tmp_node) == as_attribute
  3171.           || N_KIND(tmp_node) == as_range_attribute) attrnum(tmp_node);
  3172.         /* Write the val (N_VAL) */
  3173.         if (isval_node[N_KIND(tmp_node)]) {
  3174.             if (N_KIND(tmp_node) == as_mode) {
  3175.                 switch(strlen(namelist(N_ID(tmp_node)))) {
  3176.                 case 0:
  3177.                     N_VAL(tmp_node) = (char *)0;
  3178.                     break;
  3179.                 case 2:
  3180.                     N_VAL(tmp_node) = (char *)na_in;
  3181.                     break;
  3182.                 case 3:
  3183.                     N_VAL(tmp_node) = (char *)na_out;
  3184.                     break;
  3185.                 case 5:
  3186.                     N_VAL(tmp_node) = (char *)na_inout;
  3187.                     break;
  3188.                 default:
  3189.                     printf("node type as_mode invalid argument type %s\n",
  3190.                       namelist(N_ID(tmp_node)));
  3191.                     /*** Something more clever ***/
  3192.                 }
  3193.             }
  3194.             else
  3195.                N_VAL(tmp_node)=strjoin(namelist(N_ID(tmp_node)),"");
  3196.         }
  3197.     }
  3198.     adasem(AST(1));
  3199.     seq_node_n = 0;
  3200.     if (curtok->symbol != EOFT_SYM) {
  3201.         free_everything(AST(1));
  3202.         free_everything(AST(2));
  3203.         free_labels();
  3204.     }
  3205. }
  3206.  
  3207.  
  3208.      break;
  3209.  /* {with_clause{use_clause}} ::= empty */
  3210.  case 413 :
  3211.  node = node_new(as_list);
  3212.  N_LIST(node) = tup_new(0);
  3213.  set_span(node, &curtok->ptr.token->span);
  3214.  
  3215.      break;
  3216.  /* {with_clause{use_clause}} ::= {with_clause{use_clause}} with_clause use_c */
  3217.  case 414 :
  3218.     node = AST(0);
  3219.     N_KIND(AST(2)) = as_with_use_list;
  3220.     prepend(AST(1), AST(2));
  3221.     append(node, AST(2));
  3222.  
  3223.      break;
  3224.  /* use_clause_list ::= {pragma} */
  3225.  case 415 :
  3226.     node = AST(0);
  3227.     check_pragmas(node, context_pragmas);
  3228.  
  3229.      break;
  3230.  /* use_clause_list ::= use_clause_list use_clause {pragma} */
  3231.  case 416 :
  3232.     node = AST(0);
  3233.     check_pragmas(AST(2), context_pragmas);
  3234.     N_LIST(node) = tup_add(tup_with(N_LIST(node), (char *)AST(1)),
  3235.       N_LIST(AST(2)));
  3236.     nodefree(AST(2));
  3237.  
  3238.  
  3239.      break;
  3240.  /* {,unit_simple_name} ::= empty */
  3241.  case 417 :
  3242.  node = node_new(as_list);
  3243.  N_LIST(node) = tup_new(0);
  3244.  set_span(node, &curtok->ptr.token->span);
  3245.  
  3246.      break;
  3247.  /* {,unit_simple_name} ::= {,unit_simple_name} , unit_simple_name */
  3248.  case 418 :
  3249.     node = AST(0);
  3250.     append(node, AST(2));
  3251.  
  3252.  
  3253.      break;
  3254.  /* {|exception_choice} ::= empty */
  3255.  case 419 :
  3256.  node = node_new(as_list);
  3257.  N_LIST(node) = tup_new(0);
  3258.  set_span(node, &curtok->ptr.token->span);
  3259.  
  3260.      break;
  3261.  /* {|exception_choice} ::= {|exception_choice} '|' exception_choice */
  3262.  case 420 :
  3263.     node = AST(0);
  3264.     append(node, AST(2));
  3265.  
  3266.  
  3267.      break;
  3268.  /* {generic_parameter_declaration} ::= empty */
  3269.  case 421 :
  3270.  node = node_new(as_list);
  3271.  N_LIST(node) = tup_new(0);
  3272.  set_span(node, &curtok->ptr.token->span);
  3273.  
  3274.      break;
  3275.  /* {generic_parameter_declaration} ::= {generic_parameter_declaration} gener */
  3276.  case 422 :
  3277.     node = AST(0);
  3278.     append(node, AST(1));
  3279.  
  3280.  /* [IN[OUT]] ::= [IN] */
  3281.  /* case 423 : */
  3282.  
  3283.      break;
  3284.  /* [IN[OUT]] ::= IN OUT */
  3285.  case 424 :
  3286.     node = node_new(as_mode);
  3287.     N_ID(node) = namemap("inout", 5);
  3288.     set_span(node, LOC(0));
  3289.  
  3290.  
  3291.      break;
  3292.  /* [IS__name__or__<>] ::= empty */
  3293.  case 425 :
  3294.  node = OPT_NODE;
  3295.  
  3296.      break;
  3297.  /* [IS__name__or__<>] ::= IS name */
  3298.  case 426 :
  3299.     node = AST(1);
  3300.  
  3301.      break;
  3302.  /* [IS__name__or__<>] ::= IS <> */
  3303.  case 427 :
  3304.     node = node_new(as_simple_name);
  3305.     N_ID(node) = namemap("box", 3);
  3306.     set_span(node, LOC(1));
  3307.  
  3308.  
  3309.      break;
  3310.  /* [generic_actual_part] ::= empty */
  3311.  case 428 :
  3312.  node = OPT_NODE;
  3313.  
  3314.  /* [generic_actual_part] ::= generic_actual_part */
  3315.  /* case 429 : */
  3316.  
  3317.  
  3318.      break;
  3319.  /* {,generic_association} ::= empty */
  3320.  case 430 :
  3321.  node = node_new(as_list);
  3322.  N_LIST(node) = tup_new(0);
  3323.  set_span(node, &curtok->ptr.token->span);
  3324.  
  3325.      break;
  3326.  /* {,generic_association} ::= {,generic_association} , generic_association */
  3327.  case 431 :
  3328.     node = AST(0);
  3329.     append(node, AST(2));
  3330.  
  3331.      break;
  3332.  /* [generic_formal_parameter=>]generic_actual_parameter ::= generic_actual_p */
  3333.  case 432 :
  3334.     node = node_new(as_instance);
  3335.     insert_2child(node, OPT_NODE, AST(0));
  3336.  
  3337.      break;
  3338.  /* [generic_formal_parameter=>]generic_actual_parameter ::= generic_formal_p */
  3339.  case 433 :
  3340.     node = node_new(as_instance);
  3341.     insert_2child(node, AST(0), AST(2));
  3342.  
  3343.      break;
  3344.  /* [alignment_clause] ::= {pragma} */
  3345.  case 434 :
  3346.     check_pragmas(AST(0), null_pragmas);
  3347.     pragmalist_warning(AST(0));
  3348.     node = OPT_NODE;
  3349.     set_span(node, &curtok->ptr.token->span);
  3350.     free_everything(AST(0));
  3351.  
  3352.      break;
  3353.  /* [alignment_clause] ::= {pragma} alignment_clause {pragma} */
  3354.  case 435 :
  3355.     node = AST(1);
  3356.     check_pragmas(AST(0), null_pragmas);
  3357.     check_pragmas(AST(2), null_pragmas);
  3358.     pragmalist_warning(AST(0));
  3359.     pragmalist_warning(AST(2));
  3360.     free_everything(AST(0));
  3361.     free_everything(AST(2));
  3362.  
  3363.  
  3364.      break;
  3365.  /* {component_clause} ::= empty */
  3366.  case 436 :
  3367.  node = node_new(as_list);
  3368.  N_LIST(node) = tup_new(0);
  3369.  set_span(node, &curtok->ptr.token->span);
  3370.  
  3371.      break;
  3372.  /* {component_clause} ::= {component_clause} component_clause {pragma} */
  3373.  case 437 :
  3374.     node = AST(0);
  3375.     check_pragmas(AST(2), null_pragmas);
  3376.     pragmalist_warning(AST(2));
  3377.     append(node, AST(1));
  3378.     free_everything(AST(2));
  3379.      break;
  3380.     default :
  3381.         prs_stack->symbol = lhs[red];
  3382.         return;
  3383.     }
  3384.     prs_stack->symbol = lhs[red];
  3385.     prs_stack->ptr.ast = node;
  3386.     for (n = rhslen[red]; n--;)
  3387.         if (ISTOKEN(rh[n]))
  3388.             TOKFREE(rh[n]->ptr.token);
  3389. }
  3390.  
  3391. static Node make_id(int n)                                        /*;make_id*/
  3392. {
  3393.     /* Allocate a node for a simple name whose value and span are* known by
  3394.      * looking at the nth symbol in the right hand side of the reduction,
  3395.      * and set these fields.
  3396.      */
  3397.     Node node = node_new(as_simple_name);
  3398.     N_ID(node) = IND(n);
  3399.     set_span(node, LOC(n));
  3400.     return node;
  3401. }
  3402.  
  3403.